fix(SafariNomoduleFixPlugin): use RawSource instead of a plain object (#6470)

This commit is contained in:
Kael
2021-05-14 17:58:53 +10:00
committed by GitHub
parent 3bb2d84045
commit ca26f8cec1
2 changed files with 6 additions and 9 deletions
@@ -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,
+2 -1
View File
@@ -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": {