Skip to content

Commit

Permalink
chore: fix cosmos to start with the latest Node version
Browse files Browse the repository at this point in the history
The --experimental-policy flag was removed in Node v22.2.0.
  • Loading branch information
enellis authored and birtles committed Dec 6, 2024
1 parent bc62ba6 commit f59f01a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 12 additions & 0 deletions cosmos-import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { register } from 'node:module';
import { pathToFileURL } from 'node:url';

register(pathToFileURL('cosmos-import.js'));

export async function resolve(specifier, context, nextResolve) {
if (specifier === 'react') {
return nextResolve('preact/compat', context);
}

return nextResolve(specifier, context);
}
12 changes: 0 additions & 12 deletions cosmos-policy.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"build:safari": "rspack --env target=safari",
"build:thunderbird": "rspack --env target=thunderbird",
"check-keys": "tsx scripts/check-keys",
"cosmos": "node --experimental-policy=cosmos-policy.json node_modules/react-cosmos/bin/cosmos.js",
"cosmos-export": "node --experimental-policy=cosmos-policy.json node_modules/react-cosmos/bin/cosmos-export.js",
"cosmos": "node --import=./cosmos-import.js node_modules/react-cosmos/bin/cosmos.js",
"cosmos-export": "node --import=./cosmos-import.js node_modules/react-cosmos/bin/cosmos-export.js",
"postinstall": "if-env RELEASE_BUILD=1 || husky",
"lint": "web-ext lint && eslint src/",
"package": "rspack --env package",
Expand Down

0 comments on commit f59f01a

Please sign in to comment.