Languages

Preact / WebPack - how to disable *.js and *.css bundle chunk names shortcuting? (short names disabling)

7 points
Asked by:
Emrys-Li
580

I have noiticed, when I use multiple routings that import same module, the WebPack creates short bundle chunk names, e.g.

route-home~route-pictures~route-messages~route-admin~s~d3492c2c.chunk.1c736.css
                                                     ^
                                                     |
                                                     I want to disable this shortcutting.

Is it possible to disable this feature?

I whould like to use full route names.

Desired bundle name that I would like to get should be:

route-home~route-pictures~route-messages~route-admin~route-store.chunk.1c736.css
1 answer
7 points
Answered by:
Emrys-Li
580

Try to add to the project root the following file preact.config.js:

export default (config, env) => {
    config.optimization.splitChunks.cacheGroups = {
        commons: {
            chunks: 'all',
            name: (module, chunks) => {
                return chunks.filter(item => item.name).map(item => item.name).join('~');
            }
        }
    };
};

 

References

  1. SplitChunksPlugin | webpack 

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join