feat(vant-cli): 为 README 文件增加 vue-loader 以支持预览 demo 文件

This commit is contained in:
HaoChuan9421 2021-03-12 10:42:58 +08:00
parent a913f5bd36
commit f1d72cb016

View File

@ -24,6 +24,15 @@ const CSS_LOADERS = [
}, },
]; ];
const VUE_LOADER = {
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false,
},
},
};
const plugins = [ const plugins = [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__VUE_OPTIONS_API__: 'true', __VUE_OPTIONS_API__: 'true',
@ -74,16 +83,7 @@ export const baseConfig: WebpackConfig = {
rules: [ rules: [
{ {
test: /\.vue$/, test: /\.vue$/,
use: [ use: [VUE_LOADER],
{
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false,
},
},
},
],
}, },
{ {
test: /\.(js|ts|jsx|tsx)$/, test: /\.(js|ts|jsx|tsx)$/,
@ -115,7 +115,7 @@ export const baseConfig: WebpackConfig = {
}, },
{ {
test: /\.md$/, test: /\.md$/,
use: ['@vant/markdown-loader'], use: [VUE_LOADER, '@vant/markdown-loader'],
}, },
], ],
}, },