"vue.config.js" 文件在哪里?
Where is "vue.config.js" file?
我刚开始学习 Vue,但我无法为我的容器设置环境。
我使用 Cloud9,我必须根据 this link.
分配我的主机来为 Vue 应用程序提供服务
很遗憾,我找不到 vue.config.js
文件来执行此操作。
Vue docs也没有路径指示。
"if it's present in your project root..."
但如果不是呢?不管怎样,去使用 React 吧? :)
Vue 版本:3.1.1
vue.config.js
is an optional config file that will be automatically
loaded by @vue/cli-service
if it's present in your project root (next
to package.json
). You can also use the vue field in package.json
, but
do note in that case you will be limited to JSON-compatible values
only.
The file should export an object containing options:
// vue.config.js
module.exports = {
// options...
}
所以只需要自己创建文件。它是完全可选的。
在项目的 ROOT 文件夹中创建文件 vue.config.js
很简单。
非常重要的文件。它在 vue 项目之上。
人们通常使用旧时尚风格的不止一页。
vue.config.js 是定义主要依赖页面的正确位置。
我曾经创建过主要的单页应用程序(pwa),但我还需要
其他一些页面。例如错误页面或 google 验证。
您可以更改开发服务器端口、sourceMap enable/disable 或 PWA 配置...
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,但我无法为我的容器设置环境。 我使用 Cloud9,我必须根据 this link.
分配我的主机来为 Vue 应用程序提供服务很遗憾,我找不到 vue.config.js
文件来执行此操作。
Vue docs也没有路径指示。
"if it's present in your project root..."
但如果不是呢?不管怎样,去使用 React 吧? :)
Vue 版本:3.1.1
vue.config.js
is an optional config file that will be automatically loaded by@vue/cli-service
if it's present in your project root (next topackage.json
). You can also use the vue field inpackage.json
, but do note in that case you will be limited to JSON-compatible values only.The file should export an object containing options:
// vue.config.js module.exports = { // options... }
所以只需要自己创建文件。它是完全可选的。
在项目的 ROOT 文件夹中创建文件 vue.config.js
很简单。
非常重要的文件。它在 vue 项目之上。 人们通常使用旧时尚风格的不止一页。 vue.config.js 是定义主要依赖页面的正确位置。
我曾经创建过主要的单页应用程序(pwa),但我还需要 其他一些页面。例如错误页面或 google 验证。
您可以更改开发服务器端口、sourceMap enable/disable 或 PWA 配置...
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')