Questions tagged [splitchunksplugin]

26 questions
2
votes
1 answer

How to load split chunks in angular production?

I am using custom webpack configuration in my angular 8 project to split my each npm package into separate chunks. When i am uploading the dist folder on my aws server the browser is not fetching the split chunks. Does anyone has a solution for…
2
votes
1 answer

chunks.some is not a function

I have just upgraded from webpack 4 to webpack 5 but now when I try to build my solution, it's throwing the following error: TypeError: chunks.some is not a function This is the line in my webpack.config: optimization: { splitChunks: { …
Pete
  • 57,112
  • 28
  • 117
  • 166
2
votes
1 answer

How to use ChunkGraph API in webpack 5. splitchunks.cacheGroup?

In webpack4: splitChunks: { cacheGroups: { a: { test: (module, chunks)=>{ chunks.every(( chunk ) => { chunk.name === 'xxx' }) } } }, } In webpack 5: splitChunks: { cacheGroups: { a: { test: (module,…
2
votes
0 answers

The global variable is not defined after Splitchunks

I'm applying the SplitChunksPlugin of webpack into my service. Like, ... optimization: { splitChunks: { chunks: 'all' } } And some issues came up. Before talking about the issues, I'll tell the minified structure of my service. The web…
wallah
  • 1,964
  • 5
  • 27
  • 48
2
votes
0 answers

Prevent CSS duplication in Webpack chunks when using code split

I'm on a projet using LESS imported from JS bundled by webpack4. My problem is that the project have its own design-system, with components using same components like "typography" Example: I have a button that import typo.less. So all my chunks…
romuleald
  • 1,406
  • 16
  • 31
1
vote
0 answers

Precompiling JSX/JavaScript with babel server side then excluding babel from webpack bundle in production build. Is it possible ? How?

I'm building a react application and using webpack to bundle assets. I'm also splitting all node_module bundle so that file size will not be bloated. The goal is to reduce network request and to reduce the bundle size so I think it would be Ideal to…
German
  • 1,126
  • 8
  • 20
1
vote
1 answer

Splitting chunks - problem with regex (js)?

I'm trying to split my build files in my webpack.config.js file, but my vendors file isn't being created at all. The remaining node_modules, which aren't react or moment files end up in the main.js. An example of a file that goes in main.js is…
stumped
  • 3,235
  • 7
  • 43
  • 76
0
votes
1 answer

Webpack 5 Split chunks not working with scss imports

I have a very basic webpack(v5.75.0) file setup: webpack.config.js: const path = require('path'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { entry: { home: './src/home.js', about: './src/about.js' …
Benji40
  • 217
  • 1
  • 5
  • 12
0
votes
1 answer

How to generate single css and multiple chunks of the same css in Webpack 4?

I want to generate CSS like this: In normal chunks used by my web application. main.css 1.chunk.css 2.chunk.css .... etc And a single file server.css Because I use server.css in backend I tried to use this…
wilcus
  • 739
  • 1
  • 7
  • 17
0
votes
1 answer

Webpack 4 - Splitchunks

I have set chunks : 'all' in split chunks. But my js is compiled but it not rendering. Where should I include the chunk file. Can it be achieved without HTMLWebpackPlugin ? optimization: { splitChunks: { cacheGroups: { …
0
votes
1 answer

Webpack 4 SplitChunksPlugin - Common dependencies in Dynamic Imports

I'm using Dynamic imports with Webpack, as per the documentation: https://webpack.js.org/guides/code-splitting/#dynamic-imports Very basic example (not actual code): // main.js import('./moduleA).then((moduleA) => { …
1
2