-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Add a configuration to specify "source" public folder. #2436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is one of the sitations where i'm unsure what makes sense to add as another config option and what should be seen as a usecase for Instead of pushing a new plugin, you could adjust the existing one:
at which point the question is: Is this one-liner too much to leave to users? If we add every possible option to the config file, we will have a list of options longer than webpack itself one day. |
Unfortunately the |
I am seeing this same thing in that I want to host my vue app using Gitlab Pages. However pages have to be served from the "public" folder in the root of the repo. So I would love to be able to change the name of the public folder to "public_assets" and then copy the contents of "dist" to "public" on the CI build. |
+1 for |
+1 also required to set up with Python frameworks. |
+1 on this. I am working a PHP / Vue project and want them on the same domain. Yes I realise it's possible to do it manually but for every project we work on? |
The CLI is based upon the opinion that your frontend code and backend code should be separated. If you disagree with that, you should not use the CLI. |
@yyx990803 Thank you for your well thought out answer. Would you possibly be able to address what the recommended usage is to address the name collision for static hosting products like Gitlab Pages where the public folder at the root of a git repo has special meaning. This seems like a pretty significant collision that does not apply to renaming all of the other directories and happens with a lot of static hosting products. |
Uh oh!
There was an error while loading. Please reload this page.
What problem does this feature solve?
Presently
npm run build
will copy all files in the folder./public
(relative to the project folder) to the destination specified inoutputDir
. Which is fine if you stick to the default scaffolded folder structure (created byvue create [project_name]
).However in my case my entire vue project resides in slightly quirky folder structure like this (the
public
folder is in a 'sub folder' calledvue-project
). The 'sub folder' sort of 'encapsulates' the vue project), except for the babel, tsconfig.json, vue.config.js, etc. which all still reside in the root of the 'project folder.'The code which copies the 'public' folder assets
api.resolve('public')
resolves to either the[project folder]/public
or[environment variable VUE_CLI_CONTEXT]/public
.Unfortunately you can't workaround it by executing
cd vue-project && npm run build
nor byVUE_CLI_CONTEXT=vue-project npm run build
since other parts of the cli rely on the context being correct.EDIT:
A workaround is possible through
vue.config.js
usingCopyWebpackPlugin
, it's less pretty through:What does the proposed API look like?
Add a setting called
sourcePublicDir
invue.config.js
which value is resolved in places whereapi.resolve('public')
(andapi.resolve('public/index.html')
etc.) are called.The text was updated successfully, but these errors were encountered: