Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve 'wasm_demo/index' #1

Open
rmrfxyz opened this issue Feb 14, 2022 · 1 comment
Open

Module not found: Error: Can't resolve 'wasm_demo/index' #1

rmrfxyz opened this issue Feb 14, 2022 · 1 comment

Comments

@rmrfxyz
Copy link

rmrfxyz commented Feb 14, 2022

Thanks for publishing this repo.
I have the following issue after doing wasm-pack build and yarn && yarn dev.

Am I forgetting something?

ERROR in app/index/index.tsx:2:25
TS2307: Cannot find module 'wasm_demo/index' or its corresponding type declarations.
    1 | import * as React from "react";
  > 2 | import { testAdd } from "wasm_demo/index";
      |                         ^^^^^^^^^^^^^^^^^
    3 |
    4 | export default () => {
    5 |   console.log(testAdd(1, 2))

webpack 5.68.0 compiled with 2 errors in 32 ms
assets by status 1.25 MiB [cached] 1 asset
asset index.html 275 bytes [emitted]
cached modules 1.13 MiB (javascript) 26.9 KiB (runtime) [cached] 55 modules

@rmrfxyz
Copy link
Author

rmrfxyz commented Feb 14, 2022

UPDATE:

TL;DR:
There's a warning during yarn install:
warning @types/fork-ts-checker-webpack-plugin@0.4.5: This is a stub types definition. fork-ts-checker-webpack-plugin provides its own type definitions, so you do not need this installed.

Removing @types/fork-ts-checker-webpack-plugin seems to fix the issue with yarn.

I suppose this has something to do with this issue, which is what I ran into after trying out npm install && npm run dev

The problem persists with npm even after removing the extra dependency.
Increasing memory limit, downgrading fork-ts-checker-webpack-plugin to earlier version or editing the lib file as suggested in the thread also failed.

/.../node_modules/typescript/lib/typescript.js:2559
            throw e;
            ^

Error: Debug Failure.
    at /.../node_modules/typescript/lib/typescript.js:19608:89
    at String.replace (<anonymous>)
    at formatStringFromArgs (/.../node_modules/typescript/lib/typescript.js:19608:21)
    at Object.createCompilerDiagnostic (/.../node_modules/typescript/lib/typescript.js:19713:20)
    at tryReadFile (/.../node_modules/typescript/lib/typescript.js:39916:23)
    at Object.getParsedCommandLineOfConfigFile (/.../node_modules/typescript/lib/typescript.js:39864:30)
    at parseConfigFile (/.../node_modules/typescript/lib/typescript.js:120775:43)
    at reloadConfigFile (/.../node_modules/typescript/lib/typescript.js:120766:13)
    at updateProgram (/.../node_modules/typescript/lib/typescript.js:120741:21)
    at updateProgramWithWatchStatus (/.../node_modules/typescript/lib/typescript.js:120731:13)

Node.js v17.3.0
/.../node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:19
        closedError = new RpcIpcMessagePortClosedError_1.RpcIpcMessagePortClosedError(code
                      ^

RpcIpcMessagePortClosedError: Process 1371331 exited with code "1" [null]
    at /.../node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:19:23
    at Generator.next (<anonymous>)
    at /.../node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/.../node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:4:12)
    at ChildProcess.handleExit (/.../node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:18:42)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
  code: 1,
  signal: null
}

Node.js v17.3.0

Not sure if this is the appropriate place for this issue. I don't consider this a solution but feel free to close it at your discretion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant