MCPcopy Index your code
hub / github.com/QwikDev/qwik / buildForTarget

Function buildForTarget

scripts/binding-wasm.ts:14–41  ·  view source on GitHub ↗
(env = {})

Source from the content-addressed store, hash-verified

12 emptyDir(tmpBuildDir);
13
14 async function buildForTarget(env = {}) {
15 const cmd = `wasm-pack`;
16 const args = [`build`, '--target', 'web', `--out-dir`, tmpBuildDir, srcWasmDir];
17 if (!config.dev) {
18 args.push(`--release`);
19 }
20
21 await new Promise((resolve, reject) => {
22 const child = spawn(cmd, args, {
23 stdio: 'inherit',
24 shell: true,
25 env: {
26 ...process.env,
27 ...env,
28 },
29 });
30 child.on('error', reject);
31
32 child.on('close', (code) => {
33 if (code === 0) {
34 resolve(child.stdout);
35 } else {
36 reject(`wasm-pack exited with code ${code}`);
37 }
38 });
39 });
40 return join(tmpBuildDir, 'qwik_wasm.js');
41 }
42
43 const wasmJsBuildPath = await buildForTarget({
44 CARGO_PROFILE_RELEASE_LTO: true,

Callers 1

buildWasmBindingFunction · 0.85

Calls 3

joinFunction · 0.85
onMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…