Webpack code splitting configuration example
module.exports = { | |
entry: { | |
main: './src/app.js', | |
}, | |
output: { | |
// `filename` provides a template for naming your bundles (remember to use `[name]`) | |
filename: '[name].bundle.js', | |
// `chunkFilename` provides a template for naming code-split bundles (optional) | |
chunkFilename: '[name].bundle.js', | |
// `path` is the folder where Webpack will place your bundles | |
path: './dist', | |
// `publicPath` is where Webpack will load your bundles from (optional) | |
publicPath: 'dist/' | |
} | |
}; |
This comment has been minimized.
This comment has been minimized.
Hello Dan! Do you have a reactjs example for code splitting with webpack 4 ? I've tried so many things I've found online but I cannot get webpack to split my code. Thanks! |
This comment has been minimized.
This comment has been minimized.
If concerned about browser caching of bundles:
|
This comment has been minimized.
This comment has been minimized.
Thank you |
This comment has been minimized.
This comment has been minimized.
thanks |
This comment has been minimized.
This comment has been minimized.
Thanks |
This comment has been minimized.
This comment has been minimized.
Thank you. my [name] is coming as 1, 0 ... as chunk name. I am using import(). can we have specific names for the chunk file names? |
This comment has been minimized.
This comment has been minimized.
You can use |
This comment has been minimized.
This comment has been minimized.
code splitting & dynamic import
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
and just kick-off of an extremely simple webpack-config demo.