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

Production builds don't work with Vue JSX #270

Closed
adamwathan opened this issue May 26, 2020 · 2 comments
Closed

Production builds don't work with Vue JSX #270

adamwathan opened this issue May 26, 2020 · 2 comments

Comments

@adamwathan
Copy link

Describe the bug

When trying to run a production build for a JSX-based Vue project, the build finishes but trying to serve the dist folder doesn't render anything and gives this error:

Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".

Reproduction

Clone this repo, run yarn build, then serve the dist folder and visit it in the browser.

https://github.com/adamwathan/vite-jsx-build-fail

System Info

  • required vite version: 0.16.12
  • required Operating System: macOS 10.15.3
  • required Node version: v13.12.0
  • Optional:
    • npm/yarn version: 1.22.4
    • Installed vue version (from yarn.lock or package-lock.json): 3.0.0-beta.14
    • Installed @vue/compiler-sfc version: 3.0.0-beta.14

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
 vite build --debug
vite v0.16.12
Building for production...
  vite:resolve (extension) /Users/adamwathan/Code/vite-jsx-build-fail/Users/adamwathan/Code/vite-jsx-build-fail/index.html -> /Users/adamwathan/Code/vite-jsx-build-fail/Users/adamwathan/Code/vite-jsx-build-fail/index.html +0ms
  vite:build:asset /Users/adamwathan/Code/vite-jsx-build-fail/favicon.ico -> /_assets/favicon.0e56a3c3.ico +0ms
  vite:resolve (extension) /Users/adamwathan/Code/vite-jsx-build-fail/vite/jsx -> /Users/adamwathan/Code/vite-jsx-build-fail/vite/jsx +150ms
'vue' is imported by ../../../../vite/jsx, but could not be resolved – treating it as an external dependency
[write] dist/_assets/index.8345e3ca.js 34.91kb, brotli: 12.72kb
[write] dist/_assets/style.bba68bf6.css 0.00kb, brotli: 0.00kb
[write] dist/_assets/favicon.0e56a3c3.ico 4.19kb, brotli: 0.74kb
[write] dist/index.html 0.32kb, brotli: 0.14kb
Build completed in 2.05s.
@FelixIncerta
Copy link

FelixIncerta commented Jun 20, 2021

I have the same but with a react project with react/jsx-runtime

Uncaught TypeError: Failed to resolve module specifier "react/jsx-runtime". Relative references must start with either "/", "./", or "../".

Could you solve this ?

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants