Skip to content

Commit

Permalink
fix(dagre): Tell vite (or, actually, rollup) not to ignore try/catch.
Browse files Browse the repository at this point in the history
Judging from vitejs/vite#5759, this should
fix the Chromatic issue we've been having with dagre, and if so, will
also fix a problem we *would* have had with a production build of our
own app once we tried to render React Flow trees.
  • Loading branch information
dhess committed Jun 25, 2022
1 parent e1b7938 commit 0b60f7b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/primer-components/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ module.exports = {
plugins: [...config.plugins, svgr(), tsconfigPaths()],
// Don't write to node_modules, in case someday we can get it from Nix.
cacheDir: "../.vite",
build: {
...config.build,

// Workaround a dagre issue. See:
//
// https://github.com/vitejs/vite/issues/5759#issuecomment-1034461225
commonjsOptions: {
ignoreTryCatch: false,
},
},
};
},
};
7 changes: 7 additions & 0 deletions packages/primer-components/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export default defineConfig({
// XXX dhess: do we need to add Tailwind UI deps here?
external: ["react", "react-dom", "react-router-dom"],
},

// Workaround a dagre issue. See:
//
// https://github.com/vitejs/vite/issues/5759#issuecomment-1034461225
commonjsOptions: {
ignoreTryCatch: false,
}
},

define: {
Expand Down

0 comments on commit 0b60f7b

Please sign in to comment.