Skip to content

Commit

Permalink
Merge pull request #2696 from modernweb-dev/fix/storybook-builder-NOD…
Browse files Browse the repository at this point in the history
…E_PATH

fix(storybook-builder): clean up NODE_PATH from bundled modules output
  • Loading branch information
bashmish committed Apr 15, 2024
2 parents 482210f + 9118c64 commit 87a07c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-poems-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@web/storybook-builder': patch
---

clean up NODE_PATH from bundled modules output
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ export function rollupPluginPrebundleModules(env: Record<string, string>): Plugi
'@storybook/react-dom-shim': getReactDomShimAlias(),
}),
},
define: {
...stringifyProcessEnvs(env),
},
define: (() => {
const define = stringifyProcessEnvs(env);

// "NODE_PATH" pollutes the output, it's not used by prebundled modules and is not recommended in general
// see more https://github.com/nodejs/node/issues/38128#issuecomment-814969356
delete define['process.env.NODE_PATH'];

return define;
})(),
plugins: [
esbuildPluginCommonjsNamedExports(
modules.filter(
Expand Down

0 comments on commit 87a07c4

Please sign in to comment.