Skip to content

Commit a789c9d

Browse files
authored
fix: --esm and --brotli flags (#1760)
* fix: Correct `--esm` not being enabled by default in prod * fix: `--brotli` overwriting existing assets * docs: Adding changeset
1 parent a41d498 commit a789c9d

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/quiet-wombats-ring.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'preact-cli': patch
3+
---
4+
5+
Fixed bug in which `--esm` was not enabled by default for production builds on v3.4.2
6+
7+
Fix for `--brotli` overwriting assets

packages/cli/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ prog
3737
.option('--src', 'Specify source directory', 'src')
3838
.option('--dest', 'Specify output directory', 'build')
3939
.option('--cwd', 'A directory to use instead of $PWD', '.')
40-
.option('--esm', 'Builds ES-2015 bundles for your code', false)
40+
.option('--esm', 'Builds ES-2015 bundles for your code', true)
4141
.option('--sw', 'Generate and attach a Service Worker', true)
4242
.option('--babelConfig', 'Path to custom Babel config', '.babelrc')
4343
.option('--json', 'Generate build stats for bundle analysis', false)

packages/cli/src/lib/webpack/webpack-client-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function isProd(env) {
273273
if (env.brotli) {
274274
prodConfig.plugins.push(
275275
new CompressionPlugin({
276-
filename: '[path].br[query]',
276+
filename: '[path][base].br[query]',
277277
algorithm: 'brotliCompress',
278278
test: /\.esm\.js$/,
279279
})

0 commit comments

Comments
 (0)