Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lijialiang/replace-vue-async-router-babel-plugin
https://github.com/lijialiang/replace-vue-async-router-babel-plugin
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/lijialiang/replace-vue-async-router-babel-plugin
- Owner: lijialiang
- License: mit
- Created: 2018-10-16T03:47:43.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T08:36:49.000Z (about 6 years ago)
- Last Synced: 2024-08-11T12:15:28.134Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# replace-vue-async-router-babel-plugin
Replace some lazy loaded modules of Vue Router Component with simple functions via the Babel plugin. Reduce Webpack dependencies during development and speed up compilation.
## Install
```sh
npm i replace-vue-async-router-babel-plugin --save-dev# or
yarn add replace-vue-async-router-babel-plugin --dev
```## How to use
```js
module: {
rules: [
{
test: /.*\/router\/.*\.js$/,
use: {
loader: 'babel-loader',
options: {
plugins: [
['replace-vue-async-router-babel-plugin', { include: [ '/router/a' ] }]
]
}
}
}
]
}
```## Example
```js
new VueRouter({
routes: [
{ path: '/a', component: () => import('/router/a.vue') }, // component `a` will be used normally
{ path: '/b', component: () => import('/router/b.vue') }, // component `b` will be replaced
{ path: '/c', component: () => import('/router/c.vue') } // component `c` will be replaced
]
})
```## LICENSE
[MIT](./LICENSE)