I think, because the dynamic require is so ambiguous, Webpack determines that every file within the context directory should be bundled with the entry file so that they're all available should the dynamic require need them.
https://github.com/webpack/webpack/issues/118
A webpack loader is more dynamic than a require.js shim and is actually a lot more like a require.js plugin. The test is a regular expression which matches against the full file path, so be careful to be specific! In order to use these loaders you need to install them npm install exports-loader imports-loader.
https://www.paypal-engineering.com/2015/08/07/1450/
The paths on the client need to be right. Webpack will generate bundles for every file that is dynamically imported and load those bundle files at runtime, instead of the ones in your source directory. For example, your entry JS file is src/index.js but your output (bundle) file is dist/application.js.
https://dev.to/kayis/dynamic-imports-with-webpack-2
Dynamic Imports With Webpack 2. K. 👓 Jan 27, 2017. javascript bundling building. If you're reading this post, you probably faced a problem many single page applications have, too much JavaScript! You minified and bundled all your code with a tool of your choice, but somehow still end up with too much being loaded at your first page.
https://dev.to/kayis/dynamic-imports-with-webpack-2
Dynamic Imports With Webpack 2. K. 👓 Jan 27, 2017. If you're reading this post, you probably faced a problem many single page applications have, too much JavaScript! You minified and bundled all your code with a tool of your choice, but somehow still end up with too much being loaded at your first page.
https://dev.to/kayis/dynamic-imports-with-webpack-2
Code Splitting Formats#. Code splitting can be done in two primary ways in webpack: through a dynamic import or require.ensure syntax. The former is used in this project. The goal is to end up with a split point that gets loaded on demand. There can be splits inside splits, and you can structure an entire application based on splits.
https://survivejs.com/webpack/building/code-splitting/
Follow our migration guide or refer to webpack 2 documentation for more info. For big web apps it’s not efficient to put all code into a single file, especially if some blocks of code are only required under some circumstances. Webpack has a feature to split your codebase into “chunks” which are loaded on demand. Some other bundlers call them “layers”, “rollups”, or “fragments”.
https://webpack.github.io/docs/code-splitting.html
My entry module uses a dynamic require, which forces Webpack to try to build every file under the context directory into one gigantic bundle. Is there a way to restrict which files webpack tries to bundle in this case? For example, ignoring any files underneath various test directories?
https://github.com/webpack/webpack/issues/118
Code Splitting. Code splitting is one of the most compelling features of webpack. It allows you to split your code into various bundles which you can then load on demand — like when a user navigates to a matching route, or on an event from the user.
https://webpack.js.org/guides/code-splitting/
Edit this Page. Code splitting is one of the most compelling features of webpack. It allows you to split your code into various bundles which you can then load on demand — like when a user navigates to a matching route, or on an event from the user.
https://webpack.js.org/guides/code-splitting/
webpack dynamic require
A webpack loader is more dynamic than a require.