vite: Can't build app in production mode

Do NOT ignore this template or your issue will have a very high chance to be closed without comment.

Describe the bug

Can’t successfuly build app in production mode running “npm run build”, while it runs OK in development mode with “npm run dev”

Reproduction

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

System Info

  • required vite version: 1.0.0-rc.13
  • required Operating System: Windows 7 Ent
  • required Node version: 11.3.0
  • Optional:
    • npm/yarn version : 6.14.8
    • Installed vue version (from yarn.lock or package-lock.json) 3.0.3
    • Installed @vue/compiler-sfc version

Logs (Optional if provided reproduction)

2020-12-01T20:01:35.866Z vite:config env mode: production 2020-12-01T20:01:35.881Z 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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (3 by maintainers)

Most upvoted comments

There’s nothing we can do without the actual code.

FWIW, Vite have Windows CI, and the CI was passing when the issue was opened, so unless we can see the actual project code that is causing the build to fail, there is literally nothing we can do. Posting all these logs without a reproduction is pointless.

Also, this issue is stale now since 2.0 has a completely new resolver. If this is still an issue with 2.0, please open a new issue with proper reproduction.