添加.vue
的扩展
默认情况下, 引入SFC时如果没有.vue
后缀会报错, 这是因为vitejs
默认没有添加对.vue
文件的扩展,
1
|
yarn add -D @vuepress/bundler-vite
|
1
2
3
4
5
6
7
8
9
10
11
12
|
// .vuepress/config.js
const { viteBundler } = require("@vuepress/bundler-vite");
module.exports = {
bundler: viteBundler({
viteOptions: {
resolve: {
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
},
},
}),
}
|