From fb87a559c2fff140c2a74b47d2851876884e81a1 Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Wed, 6 Feb 2019 22:28:36 +0330 Subject: [PATCH] fix: fix non standard esm modifications --- packages/webpack/src/plugins/vue/modern.js | 8 ++++---- packages/webpack/src/utils/perf-loader.js | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/webpack/src/plugins/vue/modern.js b/packages/webpack/src/plugins/vue/modern.js index 0593429dc1..8bbccfa98d 100644 --- a/packages/webpack/src/plugins/vue/modern.js +++ b/packages/webpack/src/plugins/vue/modern.js @@ -8,6 +8,9 @@ import EventEmitter from 'events' const assetsMap = {} const watcher = new EventEmitter() +// https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc +const safariFix = `!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();` + export default class ModernModePlugin { constructor({ targetDir, isModernBuild }) { this.targetDir = targetDir @@ -97,12 +100,9 @@ export default class ModernModePlugin { // inject Safari 10 nomodule fix data.html = data.html.replace( /(<\/body\s*>)/i, - match => `${match}` + match => `${match}` ) }) }) } } - -// https://gist.github.com/samthor/64b114e4a4f539915a95b91ffd340acc -ModernModePlugin.safariFix = `!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();` diff --git a/packages/webpack/src/utils/perf-loader.js b/packages/webpack/src/utils/perf-loader.js index 2d888d2db0..7fff23f8c4 100644 --- a/packages/webpack/src/utils/perf-loader.js +++ b/packages/webpack/src/utils/perf-loader.js @@ -34,6 +34,10 @@ export default class PerfLoader { PerfLoader.warmup(options.css, ['css-loader']) } + static warmup(...args) { + warmup(...args) + } + use(poolName) { const loaders = [] @@ -59,5 +63,3 @@ export default class PerfLoader { return loaders } } - -PerfLoader.warmup = warmup