Skip to content

Commit

Permalink
include hashes in production builds of assets
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Apr 11, 2024
1 parent 6cafc68 commit 74c192c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ const coreConfig = function() {
'webpack/assets/javascripts/bundle.js'
);
config.context = path.resolve(__dirname, '..');
if (config.mode == 'production') {
var chunkFilename = '[name]-[chunkhash].js'
} else {
var chunkFilename = '[name].js'
}

config.entry = {
bundle: { import: bundleEntry, dependOn: 'vendor' },
vendor: vendorEntry,
Expand All @@ -169,6 +175,7 @@ const coreConfig = function() {
name: ['TheForeman', '[name]'],
type: 'var',
},
filename: chunkFilename,
};
var plugins = config.plugins;

Expand Down Expand Up @@ -236,6 +243,7 @@ const pluginConfig = function(plugin) {

if (config.mode == 'production') {
var outputPath = path.join(pluginRoot, 'public', 'webpack', pluginName);
var chunkFilename = '[name]-[chunkhash].js'
} else {
var outputPath = path.join(
__dirname,
Expand All @@ -244,10 +252,12 @@ const pluginConfig = function(plugin) {
'webpack',
pluginName
);
var chunkFilename = '[name].js'
}
config.output = {
path: outputPath,
publicPath: '/webpack/' + pluginName + '/',
filename: chunkFilename,
uniqueName: pluginName,
};
var configModules = config.resolve.modules || [];
Expand Down

0 comments on commit 74c192c

Please sign in to comment.