Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue3 build报错,解决方案具体参考:#1260方法试了不行 #5716

Closed
pikachuWorld opened this issue May 9, 2024 · 2 comments
Closed

Comments

@pikachuWorld
Copy link

pikachuWorld commented May 9, 2024

问题描述

报错:

error during build:
SyntaxError: Unexpected token (47:43) in D:/work//node_modules/@antv/layout/lib/layout/comboCombined.js
at Object.pp$4.raise (file://
/node_modules/rollup/dist/es/shared/node-entry.js:21621:13)
at Object.pp$9.unexpected (file:///D://node_modules/rollup/dist/es/shared/node-entry.js:18829:8)
at Object.pp$9.expectContextual (file://
/node_modules/rollup/dist/es/shared/node-entry.js:18783:41)
at Object.parseImport (file:///node_modules/rollup/dist/es/shared/node-entry.js:26127:14)
at Object.pp$8.parseStatement (file://
/node_modules/rollup/dist/es/shared/node-entry.js:19005:49)
at Object.pp$8.parseTopLevel (file:///node_modules/rollup/dist/es/shared/node-entry.js:18886:21)
at Object.parse (file://
/node_modules/rollup/dist/es/shared/node-entry.js:18658:15)
at Function.parse (file:///node_modules/rollup/dist/es/shared/node-entry.js:18708:35)
at Graph.contextParse (file://
/node_modules/rollup/dist/es/shared/node-entry.js:25754:38)
at tryParse (file://*************/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:7346:12)

重现链接

重现步骤

vue3 build报错

预期行为

vue3 build正常打包

平台

  • 操作系统: [Windows,..]
  • 网页浏览器: [Google Chrome, ]
  • G6 版本: [4.8.21... ]

补充说明(可选)

vue3 build报错

@pikachuWorld pikachuWorld changed the title vue3 build报错,官网的人方法都试了 vue3 build报错,具体参考:#1260方法试了不行 May 9, 2024
@pikachuWorld pikachuWorld changed the title vue3 build报错,具体参考:#1260方法试了不行 vue3 build报错,解决方案具体参考:#1260方法试了不行 May 9, 2024
@pikachuWorld
Copy link
Author

之前node18+vite4现在降级node14+vite3报错一样

@pikachuWorld
Copy link
Author

pikachuWorld commented May 10, 2024

问题已经解决了, commonjs()顺序问题,必须放到最上面
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';

vite.config.ts
.....
plugins: [
commonjs(),
vue(),
progress(),
visualizer({
// 打包后自动打开分析报告
open: true,
}),

    requireTransform({ fileRegex: /.js$|.ts$|vue$/ }), 
    nodeResolve({
        browser: true,
    }),
],

......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant