theloni-monk / WaveSculptr_1.0

Draw your own waveforms in either of the amplitude or frequency domains to play on a synth!
https://theloni-monk.github.io/WaveSculptr_1.0
MIT License
0 stars 0 forks source link

TSC Error: Cannot find module '../pkg/index.js' or its corresponding type declarations. #1

Open iahuang opened 3 years ago

iahuang commented 3 years ago

Environment:

Relevant logs:

$ npm i
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 1202 packages, and audited 1203 packages in 2m

41 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
$ tsc

ts/App.tsx:6:27 - error TS2307: Cannot find module '../pkg/index' or its corresponding type declarations.

6 import { WaveSynth } from '../pkg/index';
                            ~~~~~~~~~~~~~~

ts/App.tsx:7:27 - error TS2307: Cannot find module '../pkg/index' or its corresponding type declarations.

7 const wasmLoader = import('../pkg/index');
theloni-monk commented 3 years ago

You need to do the first build of the rust manually by installing wasm-pack via cargo and compiling the rust to ./pkg, from there the npm script can recompile when you make changes. Let me know if this works.