How to configure baseUrl to make__webpack_public_path__ to take effect ? I want to config publicpath dynamically
BaseUrl already does set the public path so I don't understand your request
config publicpath dynamically need to set __webpack_public_path__ in entry file , But the default value of baseurl is ‘/’ , caused the value of __webpack_public_path__ is covered by '/'. So i need to delete the publicPath attribute 。 Then how to delete it ? Or dynamic configuration publicpath in other ways.
So just so that...
Find in https://cli.vuejs.org/config/#baseurl
module.exports = {
baseUrl: process.env.NODE_ENV === 'production'
? '/production-sub-path/'
: '/'
}
Hope it can help you.
I know. It's my fault. thanks
Hi,
As said in your previous comment, __webpack_public_path__ aims at setting at runtime the public path. With the last solution, publicPath is still set at compile time.
For example, if you build once your app in "production" mode, you may deploy your (artifact) app in several environments, each environment setting his own publicPath as runtime.
The the first problem is to me still unsolved. How to use __webpack_public_path__ with vueJS?
Thanks
How to use webpack_public_path with vue-cli
The webpack docs explain it here - you set it as the very first thing in the entry file.
__webpack_public_path__ = 'whatever/path/you/want/to/set/at/runtime'
There's nothing Vue.js or Vue CLI specific to take into concideration, as far as I can see. Determining at runtime what that public path should be is your responsibility, as Vue CLI can only do it during compile time.
Most helpful comment
Find in https://cli.vuejs.org/config/#baseurl
Hope it can help you.