package.json
相邻)中存在,则将自动由@vue/cli-service
加载。您也可以在package.json
中使用vue字段,但请注意,在这种情况下,您将仅限于JSON兼容值。// vue.config.js
module.exports = {
// options...
}
所以只需自己创建文件即可。这是完全可选的。vue.config.js
文件即可。
module.exports = {
pages: {
'index': {
entry: './src/main.ts',
template: 'public/index.html',
title: 'Welcome to my vue generator project',
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
'bad': {
entry: './src/error-instance.ts',
template: 'public/bad.html',
title: 'Error page',
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
/* Disabled - Only one time
'googleVerify': {
entry: './src/error-instance.ts',
template: 'public/somelink.html',
title: 'Error page',
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
*/
},
devServer: {
'port': 3000
},
css: {
sourceMap: false
},
pwa: {
name: 'My App',
themeColor: '#4DBA87',
msTileColor: '#000000',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black',
},
}
对于这个配置,这里是主要的实例文件:
import Vue from 'vue'
import App from './App.vue'
import store from './store'
Vue.config.productionTip = false
new Vue({
store,
render: h => h(App, {
props: { error: 'You can not search for assets...' }
}),
}).$mount('#error')
如果您使用了vue-cli,那么它会在您的根目录下,像这样:
如果您没有这个文件,那么您的项目不是vue-cli,而是vit-vue, 您的配置文件名称为vit.config.vue。