1.1.0 • Published 6 years ago

babel-plugin-webpack-prefetch v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

babel-plugin-webpack-prefetch

Babel plugin for adding webpackPrefetch comment.

license npm Build Status codecov Conventional Commits

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'
)