Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: --esm and --brotli flags #1760

Merged
merged 3 commits into from Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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