Skip to content

Commit

Permalink
Add --omit-hash CLI argument to omit hashes from output filenames. (#268
Browse files Browse the repository at this point in the history
)

* Add --omit-hash CLI argument to omit hashes from the output filenames.

* Omit hashes from all bundles when using --omit-hash
  • Loading branch information
willstott101 authored and matt-gadd committed Apr 30, 2019
1 parent 9fc37d3 commit 3840e30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dist.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function webpackConfig(args: any): webpack.Configuration {
config.plugins = config.plugins.map((plugin) => {
if (plugin instanceof MiniCssExtractPlugin) {
return new MiniCssExtractPlugin({
filename: '[name].[contenthash].bundle.css'
filename: args.omitHash ? '[name].bundle.css' : '[name].[contenthash].bundle.css'
});
}
return plugin;
Expand All @@ -127,8 +127,8 @@ function webpackConfig(args: any): webpack.Configuration {
config.output = {
...output,
path: outputPath,
chunkFilename: '[name].[chunkhash].bundle.js',
filename: '[name].[chunkhash].bundle.js'
chunkFilename: args.omitHash ? '[name].bundle.js' : '[name].[chunkhash].bundle.js',
filename: args.omitHash ? '[name].bundle.js' : '[name].[chunkhash].bundle.js'
};

return config;
Expand Down
7 changes: 7 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ const command: Command = {
type: 'boolean'
});

options('omit-hash', {
describe: 'Omits hashes from output file names in dist mode',
defaultDescription: '(always false for dev builds)',
default: false,
type: 'boolean'
});

options('legacy', {
describe: 'build app with legacy browser support',
alias: 'l',
Expand Down

0 comments on commit 3840e30

Please sign in to comment.