Skip to content

Commit

Permalink
Fixed PnP compatibility for bundled components package
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed May 9, 2022
1 parent 8da2f7f commit 9b0a59c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
"@storybook/theming": "6.5.0-beta.7",
"@types/react-syntax-highlighter": "11.0.5",
"core-js": "^3.8.2",
"qs": "^6.10.0",
"react-syntax-highlighter": "^15.4.5",
"regenerator-runtime": "^0.13.7"
"regenerator-runtime": "^0.13.7",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"@popperjs/core": "^2.6.0",
Expand All @@ -64,13 +66,11 @@
"polished": "^4.2.2",
"prettier": ">=2.2.1 <=2.3.0",
"prop-types": "^15.7.2",
"qs": "^6.10.0",
"react-colorful": "^5.1.2",
"react-popper-tooltip": "^3.1.1",
"react-textarea-autosize": "^8.3.0",
"ts-dedent": "^2.0.0",
"ts-node": "^10.4.0",
"util-deprecate": "^1.0.2"
"ts-node": "^10.4.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
Expand Down
10 changes: 9 additions & 1 deletion scripts/bundle-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ interface Options {
watch?: boolean;
}

const makeExternalPredicate = (externals: string[]) => {
if (externals.length === 0) {
return () => false;
}
const pattern = new RegExp(`^(${externals.join('|')})($|/)`);
return (id: string) => pattern.test(id);
};

async function build(options: Options) {
const { input, externals, cwd, optimized } = options;
const setting: RollupOptions = {
input,
external: externals,
external: makeExternalPredicate(externals),
plugins: [
nodeResolve({
preferBuiltins: true,
Expand Down

0 comments on commit 9b0a59c

Please sign in to comment.