Skip to content

import *.vue file without .vue will not work #178

New issue

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

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

Already on GitHub? # to your account

Closed
Tracked by #6064
duanxianze opened this issue May 18, 2020 · 4 comments
Closed
Tracked by #6064

import *.vue file without .vue will not work #178

duanxianze opened this issue May 18, 2020 · 4 comments

Comments

@duanxianze
Copy link

Describe the bug

For example
A file named tsc.vue,
import tsc from "./tsc.vue";
It's ok,but
import tsc from "./tsc";
not work,report
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Reproduction

System Info

  • required vite version:0.12.0
  • required Operating System:mac os 10.15.4
  • required Node version:v12.5.0
@underfin
Copy link
Member

This isn't a bug. The import tsc from "./tsc.vue" is correct way to import vue module.

@beetaa
Copy link

beetaa commented May 18, 2020

I think @underfin is right. vite is different from webpack-compiled contents, it require module directly without solved anything, including file extensions.

@yyx990803
Copy link
Member

This is by design. We will also stop supporting extension-less Vue imports in vue-cli in the next major.

@douglasg14b
Copy link

Does the Vue CLI have this documented somewhere? I was trying to find something that standardizes how imports are expected to be formatted, but could not.

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

No branches or pull requests

5 participants