mirror of
https://github.com/zhigang1992/esbuild.git
synced 2026-04-30 18:32:49 +08:00
pass "-s -w" to go linker, removes 0.1mb (#836)
This commit is contained in:
@@ -43,7 +43,12 @@ exports.buildWasmLib = async (esbuildPath) => {
|
||||
// Asynchronously start building the WebAssembly module
|
||||
const npmWasmDir = path.join(repoDir, 'npm', 'esbuild-wasm')
|
||||
const goBuildPromise = new Promise((resolve, reject) => childProcess.execFile('go',
|
||||
['build', '-o', path.join(npmWasmDir, 'esbuild.wasm'), path.join(repoDir, 'cmd', 'esbuild')],
|
||||
[
|
||||
'build',
|
||||
'-o', path.join(npmWasmDir, 'esbuild.wasm'),
|
||||
'-ldflags=-s -w', // This removes ~0.14mb of unnecessary WebAssembly code
|
||||
path.join(repoDir, 'cmd', 'esbuild'),
|
||||
],
|
||||
{ cwd: repoDir, stdio: 'inherit', env: { ...process.env, GOOS: 'js', GOARCH: 'wasm' } },
|
||||
err => err ? reject(err) : resolve()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user