Skip to content

Commit 63f02f8

Browse files
committed
fix(safari): fix safari10 builds
1 parent 1fe168c commit 63f02f8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/compiler/optimize/optimize-module.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ export const optimizeModule = async (config: Config, compilerCtx: CompilerCtx, o
3131
}
3232

3333
let minifyOpts: MinifyOptions;
34-
if (opts.minify) {
34+
let code = opts.input;
35+
if (opts.isCore) {
36+
// IS_ESM_BUILD is replaced at build time so systemjs and esm builds have diff values
37+
// not using the BUILD conditional since rollup would input the same value
38+
code = code.replace(/\/\* IS_ESM_BUILD \*\//g, '&& false /* IS_SYSTEM_JS_BUILD */');
39+
}
40+
41+
if (opts.sourceTarget === 'es5' && opts.minify) {
3542
minifyOpts = getTerserOptions(config, opts.sourceTarget, isDebug);
3643
const compressOpts = minifyOpts.compress as CompressOptions;
3744
const mangleOptions = minifyOpts.mangle as MangleOptions;
@@ -59,7 +66,7 @@ export const optimizeModule = async (config: Config, compilerCtx: CompilerCtx, o
5966
}
6067

6168
const shouldTranspile = opts.sourceTarget === 'es5';
62-
const results = await compilerCtx.worker.prepareModule(opts.input, minifyOpts, shouldTranspile, opts.inlineHelpers);
69+
const results = await compilerCtx.worker.prepareModule(code, minifyOpts, shouldTranspile, opts.inlineHelpers);
6370
if (results != null && typeof results.output === 'string' && results.diagnostics.length === 0 && compilerCtx != null) {
6471
if (opts.isCore) {
6572
results.output = results.output.replace(/disconnectedCallback\(\)\{\},/g, '');

0 commit comments

Comments
 (0)