Skip to content

Commit

Permalink
fix(pkg): do not mangle dist build
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 25, 2022
1 parent 1a24f2a commit 3b456e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"pirates": "latest",
"semver": "latest",
"standard-version": "latest",
"terser-webpack-plugin": "latest",
"ts-loader": "latest",
"tslib": "latest",
"typescript": "latest",
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/fixtures.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TypeError [ERR_INVALID_ARG_TYPE]: The \\"listener\\" argument must be of type fu
at _addListener (events)
at process.addListener (events)
at <cwd>/index.ts
at I (<root>/dist/jiti)
at jiti (<root>/dist/jiti)
at Object.<anonymous> (<root>/bin/jiti)
at Module._compile (internal/modules/cjs/loader)
at Object.Module._extensions..js (internal/modules/cjs/loader)
Expand All @@ -53,7 +53,7 @@ exports[`fixtures > esm > stdout 1`] = `
'at getStack (<cwd>/test)',
'at test (<cwd>/test)',
'at <cwd>/index.js',
'at I (<root>/dist/jiti)',
'at jiti (<root>/dist/jiti)',
'at Object.<anonymous> (<root>/bin/jiti)',
'at Module._compile (internal/modules/cjs/loader)',
'at Object.Module._extensions..js (internal/modules/cjs/loader)',
Expand Down
11 changes: 10 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const TerserPlugin = require('terser-webpack-plugin')

const isProd = process.env.NODE_ENV === 'production'

Expand Down Expand Up @@ -40,6 +41,14 @@ module.exports = {
optimization: {
nodeEnv: false,
moduleIds: 'named',
chunkIds: 'named'
chunkIds: 'named',
minimizer: isProd && [
new TerserPlugin({
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
mangle: false
}
})
]
}
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3541,7 +3541,7 @@ tapable@^2.1.1, tapable@^2.2.0:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==

terser-webpack-plugin@^5.1.3:
terser-webpack-plugin@^5.1.3, terser-webpack-plugin@latest:
version "5.3.0"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.0.tgz#21641326486ecf91d8054161c816e464435bae9f"
integrity sha512-LPIisi3Ol4chwAaPP8toUJ3L4qCM1G0wao7L3qNv57Drezxj6+VEyySpPw4B1HSO2Eg/hDY/MNF5XihCAoqnsQ==
Expand Down

0 comments on commit 3b456e1

Please sign in to comment.