
Security News
New CNAPulse Dashboard Tracks CNA Activity and Disclosure Trends
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.
@flipace/bundle-loader
Advanced tools
[![npm][npm]][npm-url]
This bundle loader is a fork of the official bundle-loader for webpack with an added errorCb to handle chunk loading errors.
npm i @flipace/bundle-loader --save
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.bundle\.js$/,
use: '@flipace/bundle-loader'
}
]
}
}
The chunk is requested, when you require the bundle.
file.js
import bundle from './file.bundle.js';
To wait until the chunk is available (and get the exports) you need to async wait for it.
bundle((file) => {
// use the file like it was required
const file = require('./file.js')
}, (err) => { console.log('An error occurred!', err); });
This wraps the require('file.js') in a require.ensure block
Multiple callbacks can be added. They will be executed in the order of addition.
bundle(callbackTwo)
bundle(callbackThree)
If a callback is added after dependencies were loaded, it will be called immediately.
| Name | Type | Default | Description |
|---|---|---|---|
lazy | {Boolean} | false | Loads the imported bundle asynchronously |
name | {String} | [id].[name] | Configure a custom filename for your imported bundle |
lazyThe file is requested when you require the bundle-loader. If you want it to request it lazy, use:
webpack.config.js
{
loader: '@flipace/bundle-loader',
options: {
lazy: true
}
}
import bundle from './file.bundle.js'
bundle((file) => {...})
ℹ️ The chunk is not requested until you call the load function
nameYou may set name for a bundle using the name options parameter.
See documentation.
webpack.config.js
{
loader: '@flipace/bundle-loader',
options: {
name: '[name]'
}
}
:warning: chunks created by the loader will be named according to the
output.chunkFilenamerule, which defaults to[id].[name]. Here[name]corresponds to the chunk name set in thenameoptions parameter.
import bundle from './file.bundle.js'
webpack.config.js
module.exports = {
entry: {
index: './App.js'
},
output: {
path: path.resolve(__dirname, 'dest'),
filename: '[name].js',
// or whatever other format you want
chunkFilename: '[name].[id].js',
},
module: {
rules: [
{
test: /\.bundle\.js$/,
use: {
loader: '@flipace/bundle-loader',
options: {
name: 'my-chunk'
}
}
}
]
}
}
Normal chunks will show up using the filename rule above, and be named according to their [chunkname].
Chunks from bundle-loader, however will load using the chunkFilename rule, so the example files will produce my-chunk.1.js and file-2.js respectively.
You can also use chunkFilename to add hash values to the filename, since putting [hash] in the bundle options parameter does not work correctly.
FAQs
bundle loader module for webpack
We found that @flipace/bundle-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.