question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include .wasm files in output trace

See original GitHub issue

Currently it is not possible to import .wasm files through webpack on serverless functions and have them stay present in the resulting serverless build, it marks the file as having not been found

image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
styflecommented, Dec 4, 2021

It seems to find the wasm file just fine with nft.

git clone https://github.com/icyJoseph/next-battlesnake
cd next-battlesnake
git checkout with-wasm-in-git
npm i -g @vercel/nft
nft print snake-rs/pkg/snake_logic.js

It sounds like the issue is Next.js, cc @ijjk

3reactions
always-maapcommented, Mar 30, 2022

yep same issue. workaround mentioned here.

// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  webpack(config, { isServer }) {
    if (isServer) {
      config.output.webassemblyModuleFilename = './../static/wasm/[modulehash].wasm';
    } else {
      config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm';
    }
    config.experiments = { asyncWebAssembly: true };
    config.optimization.moduleIds = 'named';

    return config;
  },
};

module.exports = nextConfig;

you can check out my repo. building and deploying fine on vercel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Include .wasm files in output trace · Issue #32612 · vercel/next.js
Currently it is not possible to import .wasm files through webpack on serverless functions and have them stay present in the resulting ...
Read more >
How to debug Wasm and achieve a reliable stack trace
In this article, we will talk about Wasm, why it's difficult to debug, and some workarounds you can use when debugging Wasm that...
Read more >
Chapter 12. Debugging - WebAssembly in Action
In this mode, debug logs and intermediate files are output. The EMCC_DEBUG environment variable or the -v compiler flag are used to control...
Read more >
trace.h — Emscripten 3.1.26-git (dev) documentation
Compiler Interaction¶ ; --tracing to ; emcc at each compile and link stage. This will automatically include the ; library_trace.js library file as...
Read more >
Using the compiler | The AssemblyScript Book
A single program can have multiple entries, with the exports of each entry becoming the ... --outFile, -o Specifies the WebAssembly output file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found