Skip to content

Commit 0a02718

Browse files
committed
feat(npm-scripts): shim path package from node
Webpack 5 doesn't provide shims for built-in node packages, so we need to provide one for `path` ourselves given that `@clayui/css` uses it. We choose `path-browserify` because webpack itself suggests it. And we blindly believe and follow what webpack says.
1 parent f45ed82 commit 0a02718

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

projects/npm-tools/packages/npm-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"metal-tools-soy": "4.3.2",
5252
"mini-css-extract-plugin": "0.11.2",
5353
"minimist": "^1.2.0",
54+
"path-browserify": "^1.0.1",
5455
"prettier": "^2.1.2",
5556
"react": "*",
5657
"react-dom": "*",

projects/npm-tools/packages/npm-scripts/src/utils/createFederationConfig.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,10 @@ module.exports = async function () {
127127
}, {}),
128128
}),
129129
],
130+
resolve: {
131+
fallback: {
132+
path: require.resolve('path-browserify'),
133+
},
134+
},
130135
};
131136
};

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11804,6 +11804,11 @@ passwd-user@^3.0.0:
1180411804
dependencies:
1180511805
execa "^1.0.0"
1180611806

11807+
path-browserify@^1.0.1:
11808+
version "1.0.1"
11809+
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
11810+
integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==
11811+
1180711812
path-dirname@^1.0.0:
1180811813
version "1.0.2"
1180911814
resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0"

0 commit comments

Comments
 (0)