Description
What problem does this feature solve?
Having the Vue src files and directories in the /src directory works for simple projects, but for more complex projects it doesn't work as well. If you're including the Vuejs project in with another project with other programming languages that follow a different or same src dir causes problems. This feature will separate the vue code from the other project code (js/PHP/C#/Go/python/etc.)
Currently if you want to modify the vue src directory you need to modify vue.config.js
:
- change the alias
@
path.
configureWebpack: {
resolve: {
alias: {
'@': path.join(__dirname, vueSrc)
}
}
}
- Use the pages option to change their path:
pages: {
app_main: {
entry: path.join(vueSrc, 'main.ts'),
template: path.join(vueSrc, 'public/index.html'),
filename: 'index.html',
title: 'Index'
}
}
There might be other locations or properties that need to be updated with the change in src
directory, but these 2 are the ones I've noticed so far.
There is the public
directory that should also be considered. I assume it would also be moved into the specified Vue src
directory or made into a separate web.config.js
option.
If this is already doable without all the customization mentioned above, let me know.
What does the proposed API look like?
- Add an option to
vue.config.js
calledsrc
orvueSrc
orvueDir
orsrcDir
orvueSrcDir
or whatever is deemed appropriate. - Either assume the
public
folder is also in the newvueSrc
path or create a separatepublicSrc
(orpublicDir
) option invue.config.js
.
The value would be starting the current directory so you don't need to include the whole path.
Example: if you wanted to change the src vue directory and files from src
to webclient/vue
.
Note: The developer would manually create the new
webclient
directory in the project root. Then rename thesrc
directory tovue
and move it into thewebclient
folder. Thepublic
directory would also be moved intowebclient/vue
.
vue.config.js
module.exports = {
vueSrcDir: 'webclient/vue', // Default: /src
publicDir: 'webclient/vue' // Default: /public
}
This is NOT something that would make cli-service / webpack move the files automatically.
The vue-cli
would then change the vue src path where used by the cli-service.
The 3 places I've seen so far are:
- resolve: { alias: { '@': pathToVueSrc } }
- pages / entry / template
- The
public
directory would also be located in thepathToVueSrc
or anothervue.config.js
option.
Thanks!
Keep up the good work!