Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
babel-plugin-dynamic-import-webpack
Advanced tools
Babel plugin to transpile import() to require.ensure, for Webpack
Babel plugin to transpile import()
to require.ensure
, for Webpack.
Note that Webpack 2 has gotten import()
after this code was written.
NOTE: Babylon v6.12.0 is required to correctly parse dynamic imports.
$ npm install babel-plugin-dynamic-import-webpack --save-dev
.babelrc
(Recommended).babelrc
{
"plugins": ["dynamic-import-webpack"]
}
$ babel --plugins dynamic-import-webpack script.js
require("babel-core").transform("code", {
plugins: ["dynamic-import-webpack"]
});
Although the specification for import()
supports a dynamic importing of modules in the browser runtime, webpack's require.ensure()
is not dynamic and requires a hardcoded string to work correctly. For more information see webpack's documentation on dynamic requires.
v1.0.2
FAQs
Babel plugin to transpile import() to require.ensure, for Webpack
The npm package babel-plugin-dynamic-import-webpack receives a total of 12,105 weekly downloads. As such, babel-plugin-dynamic-import-webpack popularity was classified as popular.
We found that babel-plugin-dynamic-import-webpack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.