Vue-cli: "baseUrl" configuration does not work

Created on 5 Aug 2018  路  5Comments  路  Source: vuejs/vue-cli

Version

3.0.0-rc.10

Node and OS info

8.11.2

Steps to reproduce

The following text is translated from Chinese into English through Google Translate. If there is any inaccuracy, please forgive me.

https://github.com/mqhe2007/vue-remote-module

  1. Run the project in the github repository above.

  2. Keep the existing values or modify the value of the "baseUrl" configuration in "vue.config.js".

  3. Run "yarn build" to package.

  4. Open the "dist/clkm.umd.js" file and find the "__webpack_require__.p" variable.

  5. check the value of "__webpack_require__.p"

What is expected?

The value of "__webpack_require__.p" should be equal to the value of the "baseUrl" configuration.

What is actually happening?

The value of "__webpack_require__.p" is an empty string regardless of the value set in the "baseUrl" configuration.

All 5 comments

It doesn't make sense to have a fixed baseUrl in a library. In library mode it is configured to dynamically determine public path based on the URL from which the main js file is loaded from: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/commands/build/setPublicPath.js

Thank you, this operation is cool! Meet the needs of remote static resource references.

It doesn't make sense to have a fixed baseUrl in a library. In library mode it is configured to dynamically determine public path based on the URL from which the main js file is loaded from: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/commands/build/setPublicPath.js

window.document.currentScript does not work in IE11.

@wordythebyrd Use this polyfill: https://github.com/amiller-gh/currentScript-polyfill

It doesn't make sense to have a fixed baseUrl in a library. In library mode it is configured to dynamically determine public path based on the URL from which the main js file is loaded from: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/commands/build/setPublicPath.js

If the library is a plugin installed with NPM and the plugin uses the lazy loading, webpack does not find the other pieces. :(

Was this page helpful?
0 / 5 - 0 ratings