一覧へ戻る
chjtx/rollup-plugin-paths(新しいタブで開きます)
主要言語: JavaScript
Let you use the same variables at different directory.
- star 数
- 4
- watcher 数
- 1
- fork 数
- 1
- issue 数
- 2
- 最終更新
- 2019/06/01
主要言語: JavaScript
Let you use the same variables at different directory.
Let you use the same variables at different directory, like this:
|-- entry.js
|-- main.js
|-- pages/
|-- about.js
|-- src/
|-- lib/
|-- foo/
|-- one.js
|-- two.js
|-- vendors/
|-- jquery.js
main.js
// from src/lib/foo/one.js import { One } from 'foo@one.js' // from src/lib/foo/two.js import { Two } from 'two' // from vendors/jquery.js import 'jquery'
pages/about.js
// from src/lib/foo/one.js import { One } from 'foo@one.js'; // from vendors/jquery.js import 'jquery'
$ npm install --save-dev rollup-plugin-paths
// rollup.config.js import resolve from 'rollup-plugin-paths' export default { entry: 'entry.js', dest: 'bundle.js', plugins: [ resolve({ // Define a directory width suffix `@` "foo@": "./src/lib/foo/", // Define a path "jquery": "./vendors/jquery.js", // Define a path width a defined directory "two": "foo@two.js" }) ] }
./vendors/jquery is wrong, please do it like this ./vendors/jquery.jsfoo@goo@one.js is wrongMIT