Skip to content
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

Add build option to set publicPath #976

Closed
jdesrosiers opened this issue Mar 13, 2018 · 5 comments
Closed

Add build option to set publicPath #976

jdesrosiers opened this issue Mar 13, 2018 · 5 comments

Comments

@jdesrosiers
Copy link

jdesrosiers commented Mar 13, 2018

What problem does this feature solve?

I'm trying to deploy a Vue.js application to Github Pages. Github Pages deploys to a URL that looks like username.github.io/repo-name. The problem is that the vue-cli-service build command builds links that look like /js/vendor.2e8c48c3.js rather than repo-name/js/vendor.2e8c48c3.js or ./js/vendor.2e8c48c3.js.

There is a webpack option, publicPath, that I'm pretty sure is the solution, but there isn't a way to set that option with vue-cli.

https://webpack.js.org/api/cli/#output-options
https://github.com/webpack/docs/wiki/configuration#outputpublicpath

What does the proposed API look like?

vue-cli-service build --publicPath='/repo-name'

@yyx990803
Copy link
Member

Use baseUrl option in vue.config.js.

@miyamoto-san
Copy link

- configuration has an unknown property 'baseUrl'. These properties are valid:
vue-app            |    object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, filename?, publicPath?, port?, socket?, watchOptions?, headers?, logLevel?, clientLogLevel?, overlay?, progress?, key?, cert?, ca?, pfx?, pfxPassphrase?, requestCert?, inline?, disableHostCheck?, public?, https?, contentBase?, watchContentBase?, open?, useLocalIp?, openPage?, features?, compress?, proxy?, historyApiFallback?, staticOptions?, setup?, before?, after?, stats?, reporter?, logTime?,noInfo?, quiet?, serverSideRender?, index?, log?, warn? }

baseUrl is not valid?

@yyx990803
Copy link
Member

@johansaldes baseUrl is a top level property, not a devServer option.

@tulasi-ram
Copy link

How can we change the file name under dist folder when we build the project with vue-cli-service build

@TimYi
Copy link

TimYi commented Dec 25, 2020

@yyx990803 add a devServer option to change the baseUrl or publicPath is a good idea, this function is needed for our automatic construction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants