Bundled files and cache busting, lazy loading

Hi.
I solved it following this simple steps:

1. Create “config” directory in the root path of my project with following “webpack.config.js” file:

var webpack = require('webpack');
const defaultWebpackConfig = require('../node_modules/@ionic/app-scripts/config/webpack.config.js');

module.exports = function () {
    defaultWebpackConfig.prod.output['chunkFilename'] = "[name].[chunkhash].chunk.js";
    defaultWebpackConfig.dev.output['chunkFilename'] = "[name].[chunkhash].chunk.js";
    return defaultWebpackConfig;
};

2. Add this lines to my package.json:

"config": {
    "ionic_webpack": "./config/webpack.config.js"
},

Et voilà! Problem solved.

Hope it helps!

4 Likes