code-splitting

What's the difference between “names” and “chunks” in CommonsChunkPlugin?

心已入冬 提交于 2019-12-11 11:04:46
问题 What's the difference between those two fields in plugins options? How are they related to each other? Which one is executed first, which one second? How can I pick a package from a chunk info a separate file with these options? name: string, // or names: string[], chunks: string[], What does highlighted text below mean for chunks: string[] option? How to read child in that context? // Select the source chunks by chunk names. The chunk must be a child of the commons chunk. // If omitted all

How to require.ensure a chunk from memory-fs in webpack?

房东的猫 提交于 2019-12-11 06:39:48
问题 Let's say I have a webpack configuration uses memory-fs as outputFileSystem and the target is node. And somewhere in the code I use require.ensure to split the code. In this case, when I try to require the module it tries to find the module in the disk and throws a "module not found error". What I want is, require to load split module from memory-fs as well. I couldn't find any appropriate loader or plugin fits this case. So, I will create my own. But I couldn't decide if I need a webpack

How does Webpack's code splitting work

放肆的年华 提交于 2019-12-11 02:38:26
问题 I know little bit about webpack, but can not find a simple answer to my question. What does code splitting with Webpack mean? Is it creating individual bundle js files for different routes and performing ajax operations for getting these js files when requested by the client. Or is it performing async calls for getting other individual js files from server after showing the first requested page properly after the first hit? Before I learn how to do, I would like to have an idea about what I

Webpack - React Router V4 - code splitting duplicate modules in async chunks

我们两清 提交于 2019-12-10 10:08:55
问题 The main problem is while code splitting with react-routerV4 and then webpack 2, I have modules that are in several chunks that I can't get to the main one. My configuration is as follow : Webpack 2.2.1 React-route 4.1.1 I'm using the code splitting as in the react-router v4 documentation Basically, I don't use the import, but on the route configuration I have : something like this : import loadHome from 'bundle-loader?lazy&name=home-chunk!./pages/market/Home'; [ { path: url1, component:

How to reuse webpack vendor bundle

放肆的年华 提交于 2019-12-08 18:30:43
问题 I assume that I can achieve what I am trying to do with webpack but still could not figure it out. Here is the use case. I have couple of Angular Apps (will get loaded within same browser window) which will be reusing exactly the same vendor bundle. At the moment webpack produces two files, app.[app_module_name].js and vendor.js in each app. So theoretically I should be able to only include one vendor.js file in the html page and then load several app modules. However this does does not work

Why is webpack code splitting not working for me?

ⅰ亾dé卋堺 提交于 2019-12-08 15:33:22
问题 I'm using require.ensure to create split points at react-router paths. However, my build directory still only has app.js in addition to the vendor.js . I was expecting a separate js file for each path I used require.ensure . I used require.ensure at each path like this: <Route path= 'auth' getComponent={(nextState, callback) => { require.ensure([], (require) => { callback(null, require('containers/Authenticate/AuthenticateContainer.js').default) }, 'auth') }}/> my web pack config output for

Mix long term caching and code splitting in webpack 2

岁酱吖の 提交于 2019-12-08 08:35:22
I'm writing a javascript webapp using webpack 2 as module bundler. What I need is a way to mix long term caching feature ( https://webpack.js.org/guides/caching/ ) and code splitting ( https://webpack.js.org/guides/code-splitting/ ). I'm able to lazy load a vendor library (pixi.js in my case) using require.ensure but this cause a bundle creation including the lib. I'm also able to create cachable bundles, but I would like to create a bundle for long term caching and use it in lazy loaded part. Is it possible? Edit 1 I add some parts of my config for a better explanation. entry: { vendor: [

Mix long term caching and code splitting in webpack 2

被刻印的时光 ゝ 提交于 2019-12-08 04:52:52
问题 I'm writing a javascript webapp using webpack 2 as module bundler. What I need is a way to mix long term caching feature (https://webpack.js.org/guides/caching/) and code splitting (https://webpack.js.org/guides/code-splitting/). I'm able to lazy load a vendor library (pixi.js in my case) using require.ensure but this cause a bundle creation including the lib. I'm also able to create cachable bundles, but I would like to create a bundle for long term caching and use it in lazy loaded part. Is

Webpack + React router dynamic routing - how to catch require loading exception with require.ensure

☆樱花仙子☆ 提交于 2019-12-07 11:48:10
问题 I'm using the react/react-router/webpack stack with dynamic routing between my different pages of the app which means every page loads asynchronously by demand. Everything works great but when I deploy a new version, my current active users who didn't fetch all of the Js file of all the pages will get stuck once the'll try to navigate to another page they haven't visited yet. EXAMPLE lets say I have a code split app with the following .js generated files and md5 (for cache busting): main.123

How do I do code splitting with webpack on angular 2 app?

点点圈 提交于 2019-12-07 00:43:38
问题 I have an app structure like this: ├── /dashboard │ ├── dashboard.css │ ├── dashboard.html │ ├── dashboard.component.ts │ ├── dashboard.service.ts │ ├── index.ts ├── /users │ ├── users.css │ ├── users.html │ ├── users.component.ts │ ├── users.service.ts │ ├── index.ts ├── /login │ ├── login.css │ ├── login.html │ ├── login.component.ts │ ├── login.service.ts │ ├── index.ts ├── app.component.ts ├── app.module.ts ├── app.routes.ts ├── app.styles.css And I want to code split my app into