Skip to content

Conversation

@Andarist
Copy link
Contributor

No description provided.

"coverage": "vitest --coverage",
"upgrade-interactive": "npm-check -u"
},
"dependencies": {},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to satisfy the type-checker in vite.config.ts as I think it's worth to include packageJson.dependencies there from the start to avoid future mistakes

Comment on lines +6 to +12
const makeExternalPredicate = (externals: string[]) => {
if (externals.length === 0) {
return () => false;
}
const pattern = new RegExp(`^(${externals.join('|')})($|/)`);
return (id: string) => pattern.test(id);
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively could be something like:

Suggested change
const makeExternalPredicate = (externals: string[]) => {
if (externals.length === 0) {
return () => false;
}
const pattern = new RegExp(`^(${externals.join('|')})($|/)`);
return (id: string) => pattern.test(id);
};
const externalsPredicate = (id: string) => !id.startsWith('.')
'@emotion/unitless',
'@emotion/utils',
],
external: makeExternalPredicate([
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was that external is only handling exact matches by default and you were also importing from @emotion/react/jsx-runtime and that dragged a copy of Emotion to the bundle.

@openscript openscript merged commit b0b1041 into openscript-ch:main May 23, 2022
@Andarist Andarist deleted the fix/rollup-externals branch May 23, 2022 07:43
@tommymarshall
Copy link

I ended up here as well -- adding any @emotion dependency to the external array in my vite.config.ts file resolved my issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants