mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-22 07:10:06 -06:00
fix: use dynamic publicPath for web component bundles (fix #949)
This commit is contained in:
@@ -68,8 +68,10 @@ module.exports = (api, { target, entry, name }) => {
|
||||
config.output
|
||||
.filename(`${entryName}.js`)
|
||||
.chunkFilename(`${libName}.[id]${minify ? `.min` : ``}.js`)
|
||||
// use relative publicPath so this can be deployed anywhere
|
||||
.publicPath('./')
|
||||
// use dynamic publicPath so this can be deployed anywhere
|
||||
// the actual path will be determined at runtime by checking
|
||||
// document.currentScript.src.
|
||||
.publicPath('')
|
||||
|
||||
// externalize Vue in case user imports it
|
||||
config
|
||||
|
||||
@@ -33,6 +33,13 @@ import 'css-loader/lib/css-base'
|
||||
import 'vue-style-loader/lib/addStylesShadow'
|
||||
import 'vue-loader/lib/runtime/component-normalizer'
|
||||
|
||||
;(() => {
|
||||
let i
|
||||
if ((i = document.currentScript) && (i = i.src.match(/(.+\\/)[^/]+\\.js$/))) {
|
||||
__webpack_public_path__ = i[1]
|
||||
}
|
||||
})()
|
||||
|
||||
${files.map(file => {
|
||||
const { camelName, kebabName } = exports.fileToComponentName(prefix, file)
|
||||
return async
|
||||
|
||||
Reference in New Issue
Block a user