feat(build): expose true ESM bundle as primary artifact (#7937)
Refs #7907 Refs #7831
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
/** Dev Note:
|
||||
/** Dev Note:
|
||||
* StatsWriterPlugin is disabled by default; uncomment to enable
|
||||
* when enabled, rebuilding the bundle will cause error for assetSizeLimit,
|
||||
* which we want to keep out of CI/CD
|
||||
* post build, cli command: npx webpack-bundle-analyzer <path>
|
||||
*/
|
||||
*/
|
||||
|
||||
import configBuilder from "./_config-builder"
|
||||
import { DuplicatesPlugin } from "inspectpack/plugin"
|
||||
import { WebpackBundleSizeAnalyzerPlugin } from "webpack-bundle-size-analyzer"
|
||||
// import path from "path"
|
||||
import nodeExternals from "webpack-node-externals"
|
||||
// import { StatsWriterPlugin } from "webpack-stats-plugin"
|
||||
|
||||
const result = configBuilder(
|
||||
@@ -28,17 +28,32 @@ const result = configBuilder(
|
||||
"./src/index.js",
|
||||
],
|
||||
},
|
||||
experiments: {
|
||||
outputModule: true,
|
||||
},
|
||||
output: {
|
||||
module: true,
|
||||
libraryTarget: "module",
|
||||
library: {
|
||||
type: "commonjs2",
|
||||
export: "default",
|
||||
type: "module",
|
||||
},
|
||||
environment: {
|
||||
module: true,
|
||||
},
|
||||
},
|
||||
externalsType: "module",
|
||||
externals: [
|
||||
{
|
||||
esprima: "esprima",
|
||||
},
|
||||
nodeExternals({
|
||||
importType: (moduleName) => {
|
||||
return `module ${moduleName}`
|
||||
}})
|
||||
],
|
||||
plugins: [
|
||||
new DuplicatesPlugin({
|
||||
// emit compilation warning or error? (Default: `false`)
|
||||
emitErrors: false,
|
||||
// display full duplicates information? (Default: `false`)
|
||||
verbose: false,
|
||||
}),
|
||||
new WebpackBundleSizeAnalyzerPlugin("log.es-bundle-core-sizes.swagger-ui.txt"),
|
||||
@@ -50,4 +65,5 @@ const result = configBuilder(
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
export default result
|
||||
|
||||
Reference in New Issue
Block a user