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 b98bb68
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/primer-components/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ 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: {
sourcemap: true,

rollupOptions: {
// 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,
}
},
};
},
};
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 b98bb68

Please sign in to comment.