Skip to content

Commit

Permalink
fix: --esm and --brotli flags (#1760)
Browse files Browse the repository at this point in the history
* fix: Correct `--esm` not being enabled by default in prod

* fix: `--brotli` overwriting existing assets

* docs: Adding changeset
  • Loading branch information
rschristian committed Dec 21, 2022
1 parent a41d498 commit a789c9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/quiet-wombats-ring.md
@@ -0,0 +1,7 @@
---
'preact-cli': patch
---

Fixed bug in which `--esm` was not enabled by default for production builds on v3.4.2

Fix for `--brotli` overwriting assets
2 changes: 1 addition & 1 deletion packages/cli/src/index.js
Expand Up @@ -37,7 +37,7 @@ prog
.option('--src', 'Specify source directory', 'src')
.option('--dest', 'Specify output directory', 'build')
.option('--cwd', 'A directory to use instead of $PWD', '.')
.option('--esm', 'Builds ES-2015 bundles for your code', false)
.option('--esm', 'Builds ES-2015 bundles for your code', true)
.option('--sw', 'Generate and attach a Service Worker', true)
.option('--babelConfig', 'Path to custom Babel config', '.babelrc')
.option('--json', 'Generate build stats for bundle analysis', false)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/webpack/webpack-client-config.js
Expand Up @@ -273,7 +273,7 @@ function isProd(env) {
if (env.brotli) {
prodConfig.plugins.push(
new CompressionPlugin({
filename: '[path].br[query]',
filename: '[path][base].br[query]',
algorithm: 'brotliCompress',
test: /\.esm\.js$/,
})
Expand Down

0 comments on commit a789c9d

Please sign in to comment.