如何更改 VUE 中的主文件夹 [英] How can I change main folders in VUE
问题描述
我是 Vue 的新手.我只是通过 vue create my-project-name
创建 vue 项目.
工作正常.
但是如何更改文件夹结构?将 src
和 public
包裹在 client
文件夹中?
应用程序文件夹:|-客户|- 源代码|- 公开|- package.json
仍然使用所有 cli 功能?
更改 package.json
中的 serve
和 build
脚本:>
vue-cli-service serve
到 vue-cli-service serve client/src
vue-cli-service build
到 vue-cli-service build client/src
和vue.config.js
devServer.contentBase
const path = require('path');模块.出口 = {开发服务器:{contentBase: path.join(__dirname, 'client/public')}}
I'm new in Vue. I just create vue project by vue create my-project-name
.
works fine.
But how can I change the folder structure? wrap src
and public
in client
folder?
app folders:
|-client
|- src
|- public
|- package.json
and still use all the cli features?
Change serve
and build
scripts in package.json
:
vue-cli-service serve
to vue-cli-service serve client/src
vue-cli-service build
to vue-cli-service build client/src
And devServer.contentBase
in vue.config.js
const path = require('path');
module.exports = {
devServer: {
contentBase: path.join(__dirname, 'client/public')
}
}
这篇关于如何更改 VUE 中的主文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!