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

PublicPath in vue.config.js ignored #4160

Closed
Ronaldho80 opened this issue Jun 17, 2019 · 4 comments
Closed

PublicPath in vue.config.js ignored #4160

Ronaldho80 opened this issue Jun 17, 2019 · 4 comments

Comments

@Ronaldho80
Copy link

Version

3.8.4

Reproduction link

https://github.com/Ronaldho80/vue-cli-issue

Environment info


Environment Info:

  System:
    OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Binaries:
    Node: 8.15.1 - /usr/bin/node
    Yarn: 1.12.3 - /usr/bin/yarn
    npm: 6.4.1 - /usr/bin/npm
  Browsers:
    Chrome: 75.0.3770.80
    Firefox: 67.0.2
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.8.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli: ^3.8.4 => 3.8.4 
    @vue/cli-overlay:  3.8.0 
    @vue/cli-plugin-babel: ^3.6.0 => 3.8.0 
    @vue/cli-plugin-eslint: ^3.0.4 => 3.8.0 
    @vue/cli-service: ^3.0.4 => 3.8.4 
    @vue/cli-shared-utils:  3.8.0 
    @vue/cli-ui:  3.8.4 
    @vue/cli-ui-addon-webpack:  3.8.4 
    @vue/cli-ui-addon-widgets:  3.8.4 
    @vue/component-compiler-utils:  2.6.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue:  4.7.1 
    typescript:  3.5.2 
    vue: ^2.5.17 => 2.6.10 
    vue-affix: ^0.5.2 => 0.5.2 
    vue-cli-plugin-apollo:  0.20.0 
    vue-cli-plugin-material: ^0.2.3 => 0.2.3 
    vue-cli-plugin-vuetify: ^0.2.0 => 0.2.1 
    vue-clip: ^1.0.0 => 1.0.0 
    vue-codemirror: ^4.0.5 => 4.0.6 
    vue-eslint-parser:  2.0.3 
    vue-google-charts: ^0.3.2 => 0.3.2 
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-router: ^3.0.1 => 3.0.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.5.17 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vue-transmit: ^8.1.4 => 8.1.4 
    vue2-ace-editor: ^0.0.11 => 0.0.11 
    vuebar: ^0.0.20 => 0.0.20 
    vuejs-logger: ^1.5.3 => 1.5.3 
    vuetify: ^1.5.0 => 1.5.14 
    vuetify-upload-button: ^1.2.2 => 1.2.2 
    vuex: ^3.0.1 => 3.1.1 
  npmGlobalPackages:
    @vue/cli: Not Found


Steps to reproduce

  • yarn install
  • yarn build
  • cat dist/index.html

What is expected?

dist/index.htmls paths shall have '/ltx2/' as a prefix.

What is actually happening?

There is no prefix in the pahts in index.html


The publicPath veriable is set in vue.config.js:

module.export = {
publicPath: '/ltx2/',
devServer: {
disableHostCheck: true
}
}

@zrh122
Copy link
Contributor

zrh122 commented Jun 17, 2019

// vue.config.js is not right
module.exports = {  // <- should be module.exports
  publicPath: '/ltx2/',
  devServer: {
    disableHostCheck: true
  }
}

@Ronaldho80

@Ronaldho80
Copy link
Author

omg.. Thanks a lot! Just for you to know, I wrote to the vue forum and to several chat rooms before I made it an issue at the vue-cli repository.

@abargstaedt
Copy link

publicPath is still ignored when building a library:

vue-cli-service build --target lib --inline-vue --name module src/main.js

@folmert
Copy link

folmert commented Dec 12, 2023

Regardless of your publicPath when building a lib it will be overwritten at this line:

and also at this line:

__webpack_public_path__ = src[1] // eslint-disable-line

(which, strangely, seems to be executed only in Firefox... added with MR: #5247)

vue-cli maintainers, please provide a way to assign a custom publicPath in lib builds. What's the point of this option if it cannot be used?

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

4 participants