-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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 for build target lib #4896
Comments
vue-cli/packages/@vue/cli-service/lib/commands/build/resolveLibConfig.js Lines 114 to 133 in ef548a7
|
const path = require('path')
const ASSET_PATH = '//localhost:4003/';
function PublicPathWebpackPlugin () {}
PublicPathWebpackPlugin.prototype.apply = function (compiler) {
compiler.hooks.entryOption.tap('PublicPathWebpackPlugin', (context, entry) => {
if (entry['module.common']) {
entry['module.common'] = path.resolve(__dirname, './src/main.js')
}
if (entry['module.umd']) {
entry['module.umd'] = path.resolve(__dirname, './src/main.js')
}
if (entry['module.umd.min']) {
entry['module.umd.min'] = path.resolve(__dirname, './src/main.js')
}
});
compiler.hooks.beforeRun.tap('PublicPathWebpackPlugin', (compiler) => {
compiler.options.output.publicPath = ASSET_PATH
})
}
module.exports = {
publicPath: ASSET_PATH,
configureWebpack (config) {
config.plugins.unshift(new PublicPathWebpackPlugin())
}
}; |
Even though |
vue-cli/packages/@vue/cli-service/lib/commands/build/resolveLibConfig.js Lines 114 to 133 in ef548a7
It's a shame it hasn't been resolved after 4 years. It should be still possible to set publicPath for libs, if someone wants to.
|
Version
4.1.1
Reproduction link
https://github.com/abargstaedt/poc-module-vue-cli
Environment info
Steps to reproduce
What is expected?
Logo PNG should be referenced to "//localhost:4003/img/logo.82b9c7a5.png"
What is actually happening?
Logo PNG is referenced to "img/logo.82b9c7a5.png"
We're aiming to host AMD/UMD modules on our web-space with the ability to load assets from the same location.
The text was updated successfully, but these errors were encountered: