一覧へ戻る
Shopify/rollup-plugin-remap(新しいタブで開きます)
主要言語: JavaScript
- star 数
- 1
- watcher 数
- 342
- fork 数
- 5
- issue 数
- 4
- 最終更新
- 2026/03/28
主要言語: JavaScript
Plugin to remap imported modules to other file paths. Useful for conditional
compilation, ie: remapping development focused modules to a noop during a
production build.
In this example, we're remapping a logger module to a noop module during a production build of a project.
rollup.config.js
const plugins = []; if (process.env.BUILD_MODE === 'proudction') { plugins.push(remap({ originalPath: 'src/logger.js', targetPath: 'src/noop.js' })); } export default { entry: 'src/someModule.js', plugins }
Would remap the following import to a file called src/noop.js.
src/someModule.js
import logger from './logger'; export default function doStuff() { // ... // do some stuff // ... logger('I did some stuff'); }