Vite: import *.vue file without .vue will not work

Created on 18 May 2020  路  3Comments  路  Source: vitejs/vite

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

pending triage

Most helpful comment

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

All 3 comments

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wobsoriano picture wobsoriano  路  4Comments

stefnotch picture stefnotch  路  3Comments

jakobrosenberg picture jakobrosenberg  路  3Comments

ais-one picture ais-one  路  3Comments

robrich picture robrich  路  4Comments