mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-05-04 19:10:01 -05:00
fix(SafariNomoduleFixPlugin): use RawSource instead of a plain object (#6470)
This commit is contained in:
@@ -23,6 +23,9 @@ class SafariNomoduleFixPlugin {
|
||||
if (!needsSafariFix) {
|
||||
return
|
||||
}
|
||||
const { RawSource } = compiler.webpack
|
||||
? compiler.webpack.sources
|
||||
: require('webpack-sources')
|
||||
|
||||
const ID = 'SafariNomoduleFixPlugin'
|
||||
compiler.hooks.compilation.tap(ID, compilation => {
|
||||
@@ -40,14 +43,7 @@ class SafariNomoduleFixPlugin {
|
||||
// inject the fix as an external script
|
||||
const safariFixPath = path.join(this.jsDirectory, 'safari-nomodule-fix.js')
|
||||
const fullSafariFixPath = path.join(compilation.options.output.publicPath, safariFixPath)
|
||||
compilation.assets[safariFixPath] = {
|
||||
source: function () {
|
||||
return Buffer.from(safariFix)
|
||||
},
|
||||
size: function () {
|
||||
return Buffer.byteLength(safariFix)
|
||||
}
|
||||
}
|
||||
compilation.assets[safariFixPath] = new RawSource(safariFix)
|
||||
scriptTag = {
|
||||
tagName: 'script',
|
||||
closeTag: true,
|
||||
|
||||
@@ -83,7 +83,8 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/compiler-sfc": "^3.0.0-beta.14",
|
||||
"vue-template-compiler": "^2.0.0"
|
||||
"vue-template-compiler": "^2.0.0",
|
||||
"webpack-sources": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/compiler-sfc": {
|
||||
|
||||
Reference in New Issue
Block a user