Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit f52f150

Browse files
committed
Terser compatibility
1 parent c3df855 commit f52f150

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/create_compilers/RollupCompiler.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default class RollupCompiler {
134134
if (targetModuleId) {
135135
return {
136136
left: 'Promise.all([import(',
137-
right: `), /* ___${targetModuleId}___ */]).then(x => x[0])`
137+
right: `), ___SAPPER_CSS_INJECTION___${Buffer.from(targetModuleId).toString('hex')}___]).then(x => x[0])`
138138
};
139139
} else {
140140
return {
@@ -176,7 +176,8 @@ export default class RollupCompiler {
176176
let chunk_has_css = false;
177177

178178
if (chunk.code) {
179-
chunk.code = chunk.code.replace(/\/\* ___(.+?)___ \*\//g, (m, id) => {
179+
chunk.code = chunk.code.replace(/___SAPPER_CSS_INJECTION___([0-9a-f]+)___/g, (m, id) => {
180+
id = Buffer.from(id, 'hex').toString();
180181
const target = <OutputChunk>Object.values(bundle).find(c => (<OutputChunk>c).facadeModuleId === id);
181182

182183
if (target) {
@@ -190,7 +191,7 @@ export default class RollupCompiler {
190191
}
191192
}
192193

193-
return m;
194+
return '';
194195
});
195196

196197
if (chunk_has_css) {

0 commit comments

Comments
 (0)