Skip to content

Commit

Permalink
feat(build): add support for Create React App without eject (#7946)
Browse files Browse the repository at this point in the history
Refs #7898
Refs #7944
Refs #7935
Refs #7910
Refs #7908
Refs #7902
  • Loading branch information
char0n authored Mar 28, 2022
1 parent 177240c commit 81ef19c
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions webpack/es-bundle-core.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ import { WebpackBundleSizeAnalyzerPlugin } from "webpack-bundle-size-analyzer"
import nodeExternals from "webpack-node-externals"
// import { StatsWriterPlugin } from "webpack-stats-plugin"

const minimize = true
const sourcemaps = true

const result = configBuilder(
{
minimize: true,
minimize,
mangle: true,
sourcemaps: true,
sourcemaps,
includeDependencies: false,
},
{
Expand All @@ -41,12 +44,28 @@ const result = configBuilder(
module: true,
},
},
devtool: sourcemaps && minimize ? "source-map" : false,
externalsType: "module",
externals: [
{
esprima: "esprima",
},
nodeExternals({
allowlist: [
/object\/define-property/, // @babel/runtime-corejs3 import which makes fragment work with Jest
"deep-extend", // uses Buffer as global symbol
"randombytes", // uses require('safe-buffer')
"sha.js", // uses require('safe-buffer')
"xml", // uses require('stream')
/process\/browser/, // is injected via ProvidePlugin
/readable-stream/, // byproduct of buffer ProvidePlugin injection
"util-deprecate", // dependency of readable-stream
"inherits", // dependency of readable-stream
"events", // dependency of readable-stream
/safe-buffer/, // contained in resolve.alias
/string_decoder/, // byproduct of buffer ProvidePlugin injection
"buffer", // buffer is injected via ProvidePlugin
],
importType: (moduleName) => {
return `module ${moduleName}`
}})
Expand All @@ -65,5 +84,4 @@ const result = configBuilder(
}
)


export default result

0 comments on commit 81ef19c

Please sign in to comment.