简体   繁体   中英

How can I include dagre/graphlib in a vue.js site built with vite

["

I want to include dagre (or graphlib, get same issues) in a vite based vue project but hitting issues at either runtime or build time depending on options I've tried.<\/i>

➜ npm create vite@latest
✔ Project name: … demo
✔ Select a framework: › vue
✔ Select a variant: › vue

A workaround is to add an option to the CommonJS compilation module, it's discussed on GitHub: https://github.com/vitejs/vite/issues/5759#issuecomment-1034461225

Vite's config file should be changed like so:

build: {
    commonjsOptions: {
        ignoreTryCatch: false
    }
}

Also be sure to remove the CommonJS Rollup plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM