Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 0fb2b48

Browse files
committed
fix: add workaround for denoland/deno#9212
1 parent 2f196bb commit 0fb2b48

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

server/project.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { initWasm, SWCOptions, TransformOptions, transpileSync } from '../compiler/mod.ts'
2-
import type { AcceptedPlugin, ServerRequest } from '../deps.ts'
2+
import type { AcceptedPlugin, ECMA, ServerRequest } from '../deps.ts'
33
import { CleanCSS, colors, ensureDir, less, marked, minify, path, postcss, safeLoadFront, Sha1, Sha256, walk } from '../deps.ts'
44
import { EventEmitter } from '../framework/core/events.ts'
55
import { getPagePath, RouteModule, Routing } from '../framework/core/routing.ts'
@@ -1416,7 +1416,6 @@ export class Project {
14161416
if (!existsFileSync(bundleFile)) {
14171417
const msg = (new TextDecoder).decode(data).replaceAll('file://', '').replaceAll(this.buildDir, '/aleph.js')
14181418
await Deno.stderr.write((new TextEncoder).encode(msg))
1419-
console.log(['deno', 'bundle', '--no-check', reload ? '--reload' : '', bundlingFile, bundleFile].filter(Boolean).join(' '))
14201419
Deno.exit(1)
14211420
}
14221421

@@ -1428,6 +1427,9 @@ export class Project {
14281427
},
14291428
})
14301429

1430+
// workaround for https://github.com/denoland/deno/issues/9212
1431+
code = code.replace(' _ = l.baseState, ', ' var _ = l.baseState, ')
1432+
14311433
// IIFEify
14321434
code = [
14331435
'(() => {',
@@ -1437,15 +1439,15 @@ export class Project {
14371439
].join('\n')
14381440

14391441
// minify code
1440-
// const ret = await minify(code, {
1441-
// compress: true,
1442-
// mangle: true,
1443-
// ecma: parseInt(util.trimPrefix(this.config.buildTarget, 'es')) as ECMA,
1444-
// sourceMap: false
1445-
// })
1446-
// if (ret.code) {
1447-
// code = ret.code
1448-
// }
1442+
const ret = await minify(code, {
1443+
compress: true,
1444+
mangle: true,
1445+
ecma: parseInt(util.trimPrefix(this.config.buildTarget, 'es')) as ECMA,
1446+
sourceMap: false
1447+
})
1448+
if (ret.code) {
1449+
code = ret.code
1450+
}
14491451

14501452
await cleanupCompilation(bundleFile)
14511453
await Deno.writeTextFile(bundleFile, code)

0 commit comments

Comments
 (0)