diff --git a/src/patches/snapshot.ts b/src/patches/snapshot.ts index c500498..f74204d 100644 --- a/src/patches/snapshot.ts +++ b/src/patches/snapshot.ts @@ -1,5 +1,6 @@ import { resolve } from 'path' import { NexeCompiler } from '../compiler' +import { semverGt } from '../util' export default async function(compiler: NexeCompiler, next: () => Promise) { const { snapshot, warmup, cwd } = compiler.options @@ -8,13 +9,18 @@ export default async function(compiler: NexeCompiler, next: () => Promise) return next() } + const variablePrefix = semverGt(compiler.target.version, '11.0.0') ? 'v8_' : '' + await compiler.replaceInFileAsync( compiler.configureScript, 'def configure_v8(o):', - `def configure_v8(o):\n o['variables']['embed_script'] = r'${resolve( + `def configure_v8(o):\n o['variables']['${variablePrefix}embed_script'] = r'${resolve( cwd, snapshot - )}'\n o['variables']['warmup_script'] = r'${resolve(cwd, warmup || snapshot)}'` + )}'\n o['variables']['${variablePrefix}warmup_script'] = r'${resolve( + cwd, + warmup || snapshot + )}'` ) return next()