Skip to content

Commit 5270373

Browse files
author
winjo
committed
build: fix webpack externals config
1 parent e81cbc2 commit 5270373

3 files changed

Lines changed: 21 additions & 29 deletions

File tree

packages/alex/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@
7676
},
7777
"devDependencies": {
7878
"@types/react": "^16.9.56",
79-
"@types/react-dom": "^16.9.9",
79+
"@types/react-dom": "^16.9.9"
80+
},
81+
"peerDependencies": {
8082
"antd": "^3.20.3",
8183
"react": "^16.14.0",
8284
"react-dom": "^16.14.0"

packages/toolkit/webpack/config.build.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,23 @@ module.exports = createWebpackConfig({
2323
library: 'Alex',
2424
libraryTarget: 'umd',
2525
},
26-
externals({ context, request }, callback) {
27-
if (/^antd/.test(request) || request === 'react' || request === 'react-dom') {
28-
// Externalize to a commonjs module using the request path
29-
return callback(null, 'commonjs ' + request);
30-
}
31-
32-
// Continue without externalizing the import
33-
callback();
34-
},
26+
externals: [
27+
{
28+
react: {
29+
root: 'React',
30+
commonjs2: 'react',
31+
commonjs: 'react',
32+
amd: 'react',
33+
},
34+
'react-dom': {
35+
root: 'ReactDOM',
36+
commonjs2: 'react-dom',
37+
commonjs: 'react-dom',
38+
amd: 'react-dom',
39+
},
40+
},
41+
/^antd/,
42+
],
3543
optimization: {
3644
minimize: false,
3745
},

yarn.lock

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10220,16 +10220,6 @@ react-custom-scrollbars@^4.2.1:
1022010220
prop-types "^15.5.10"
1022110221
raf "^3.1.0"
1022210222

10223-
react-dom@^16.14.0:
10224-
version "16.14.0"
10225-
resolved "https://registry.npm.alibaba-inc.com/react-dom/download/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89"
10226-
integrity sha1-etg47Cmnd/s8dcOhkPZhz5Kri4k=
10227-
dependencies:
10228-
loose-envify "^1.1.0"
10229-
object-assign "^4.1.1"
10230-
prop-types "^15.6.2"
10231-
scheduler "^0.19.1"
10232-
1023310223
react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.6:
1023410224
version "16.13.1"
1023510225
resolved "https://registry.npm.alibaba-inc.com/react-is/download/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
@@ -10305,7 +10295,7 @@ react-window@^1.8.5:
1030510295
"@babel/runtime" "^7.0.0"
1030610296
memoize-one ">=3.1.1 <6"
1030710297

10308-
react@^16.14.0, react@^16.8.6:
10298+
react@^16.8.6:
1030910299
version "16.14.0"
1031010300
resolved "https://registry.npm.alibaba-inc.com/react/download/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"
1031110301
integrity sha1-lNd23dCqo32j7aj8W2sYpMmjEU0=
@@ -10824,14 +10814,6 @@ saxes@^5.0.0:
1082410814
dependencies:
1082510815
xmlchars "^2.2.0"
1082610816

10827-
scheduler@^0.19.1:
10828-
version "0.19.1"
10829-
resolved "https://registry.npm.alibaba-inc.com/scheduler/download/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
10830-
integrity sha1-Tz4u0sGn1laB9MhU+oxaHMtA8ZY=
10831-
dependencies:
10832-
loose-envify "^1.1.0"
10833-
object-assign "^4.1.1"
10834-
1083510817
schema-utils@2.7.0:
1083610818
version "2.7.0"
1083710819
resolved "https://registry.npm.alibaba-inc.com/schema-utils/download/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7"

0 commit comments

Comments
 (0)