babel-plugin-transform-ensure-ignore
require.ensure
is cool, but we don't need it in Node env.
see more https://webpack.github.io/docs/code-splitting.html#defining-a-split-point
this plugin will help to transform code below:
require;
to
;
Configure it in .babelrc
for node, we could ignore the requirement when run test in node or build server render app.
Then we run babel with BABEL_ENV=node
will active this plugin;
"env": "node": "plugins": "babel-plugin-transform-ensure-ignore"
or use with babel-register
in require-hooks
'plugins': 'babel-plugin-transform-ensure-ignore' ;
Or with cli like other plugin used.
Notice:
- Don't use this in webpack system
- make sure the correct usage of
require.ensure