Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions packages/@vue/cli-service/lib/webpack/SafariNomoduleFixPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/@vue/cli-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down