Skip to content

Commit

Permalink
[core][enhancement] Disable WeakRef usage in WyW modulate evaluation
Browse files Browse the repository at this point in the history
phase to avoid the "Invariant: Module 00041 has been disposed" issues.
This results in more reliability but at the cost of more memory consumption
which should be fine for now.
  • Loading branch information
brijeshb42 committed Apr 19, 2024
1 parent de70dee commit 119eb06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/pigment-css-unplugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ export const plugin = createUnplugin<PigmentOptions, true>((options) => {
themeArgs: {
theme,
},
features: {
useWeakRefInEval: false,
// If users know what they are doing, let them override to true
...rest.features,
},
overrideContext(context: Record<string, unknown>, filename: string) {
if (overrideContext) {
return overrideContext(context, filename);
Expand Down
5 changes: 5 additions & 0 deletions packages/pigment-css-vite-plugin/src/vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ export default function wywVitePlugin({
preprocessor,
pluginOptions: {
...rest,
features: {
useWeakRefInEval: false,
// If users know what they are doing, let them override to true
...rest.features,
},
babelOptions: {
...rest.babelOptions,
plugins: [
Expand Down

0 comments on commit 119eb06

Please sign in to comment.