0

我无法在 Windows 上以生产模式构建新创建的 vue3+vite 应用程序,而它在开发模式下运行正常。以下是我执行以获得错误的步骤:

npx create-vite-app test_vue3
cd test_vue3
npm install
npm run build

错误是:

2020-12-01T21:42:14.689Z vite:config env mode: production
2020-12-01T21:42:14.705Z vite:config env: {}
[vite] Build errored out.
{ Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:5253:30)
    at Module.error (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:9821:16)
    at tryParse (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:9702:23)
    at Module.setSource (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:10128:19)
    at ModuleLoader.addModuleSource (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:18289:20)
  code: 'PARSE_ERROR',
  parserError:
   { SyntaxError: Unexpected token (1:0)
       at Object.pp$4.raise (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:15543:13)
       at Object.pp.unexpected (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:13235:8)
       at Object.pp$3.parseExprAtom (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14942:10)
       at Object.pp$3.parseExprSubscripts (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14745:19)
       at Object.pp$3.parseMaybeUnary (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14722:17)
       at Object.parseMaybeUnary (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:19145:29)
       at Object.pp$3.parseExprOps (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14657:19)
       at Object.pp$3.parseMaybeConditional (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14640:19)
       at Object.pp$3.parseMaybeAssign (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14608:19)
       at Object.pp$3.parseExpression (D:\test_vue3\node_modules\rollup\dist\shared\rollup.js:14574:19) pos: 0, loc: Position { line: 1, column: 0 }, raisedAt: 1 },
  id: 'D:\\Proj_VUE\\test_vue3\\index.html',
  pos: 0,
  loc:
   { file: 'D:\\Proj_VUE\\test_vue3\\index.html',
     line: 1,
     column: 0 },
  frame: '1: <!DOCTYPE html>\n   ^\n2: <html lang="en">\n3: <head>',
  watchFiles: [ 'D:\\Proj_VUE\\test_vue3\\index.html' ] }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test_vue3@0.0.0 build: `vite build --debug`
npm ERR! Exit status 1

有没有办法以某种方式解决它?(我在 linux 上试过,效果很好)

4

0 回答 0