babel-plugin-webpack-prefetch
v1.1.0 babel babel-plugin webpack prefetch preload
babel-plugin-webpack-prefetch
Babel plugin for adding webpackPrefetch comment.
Usage
yarn add -D babel-plugin-webpack-prefetch
then add babel-plugin-webpack-prefetch
to your .babelrc
{
"plugins": [
+ "babel-plugin-webpack-prefetch"
]
}
And it does :
import ccc from 'ddd'
import 'aaa'
const a = import(
+ /* webpackPrefetch: true */
'aaa'
)
const b = import(
+ /* webpackPrefetch: true */
'bbb'
)
babel-plugin-webpack-prefetch
will respect your comment :
const a = import(
// you added webpackPrefetch: false so babel-plugin-webpack-prefetch will not modify it
/* webpackPrefetch: false */
'aaa'
)
const b = import(
+ /* webpackPrefetch: true */
'bbb'
)
npm i babel-plugin-webpack-prefetch
Metadata
- MIT
- >=6
- Wu Haotian
- released 4/25/2018