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

TypeScript warnings when consuming wasm-pack output #1030

Open
donmccurdy opened this issue Jul 7, 2021 · 2 comments
Open

TypeScript warnings when consuming wasm-pack output #1030

donmccurdy opened this issue Jul 7, 2021 · 2 comments

Comments

@donmccurdy
Copy link

🐛 Bug description

I've published an npm package built with wasm-pack, https://github.com/donmccurdy/mikktspace-wasm, and the notable configuration is in its package.json. When trying to use this package in another project (using TypeScript, Webpack, and Svelte) I'm seeing many warnings like these:

error.txt
webpack serve --content-base public
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from public
✖ 「wdm」: asset build/bundle.js 531 KiB [emitted] (name: build/bundle) 1 related asset
asset 39f576dd15b04118ab91cb9209690a4b.wasm 32.8 KiB [emitted] [immutable] [from: node_modules/mikktspace/dist/mikktspace_module_bg.wasm] (auxiliary name: build/bundle)
runtime modules 27.1 KiB 14 modules
modules by path ./node_modules/ 443 KiB 42 modules
modules by path ./src/ 5.88 KiB
  modules by path ./src/*.css 3.15 KiB
    ./src/global.css 2.66 KiB [built] [code generated]
    ./node_modules/css-loader/dist/cjs.js!./src/global.css 498 bytes [built] [code generated]
  ./src/main.ts 142 bytes [built] [code generated] [1 error]
  ./src/App.svelte 2.59 KiB [built] [code generated]

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 11:73-91
export 'memory' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 12:46-64
export 'memory' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 52:77-95
export 'memory' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 53:50-68
export 'memory' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 69:73-91
export 'memory' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 70:46-64
export 'memory' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 87:23-59
export '__wbindgen_add_to_stack_pointer' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 88:49-71
export '__wbindgen_malloc' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 90:47-69
export '__wbindgen_malloc' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 92:49-71
export '__wbindgen_malloc' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 94:8-29
export 'generateTangents' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 98:8-28
export '__wbindgen_free' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

WARNING in ./node_modules/mikktspace/dist/mikktspace_module_bg.js 101:8-44
export '__wbindgen_add_to_stack_pointer' (imported as 'wasm') was not found in './mikktspace_module_bg.wasm' (possible exports: default)
 @ ./node_modules/mikktspace/dist/mikktspace_module.js 2:0-42 2:0-42
 @ ./src/App.svelte 17:0-41 56:13-23 63:34-44
 @ ./src/main.ts 2:0-31 3:16-19

I can't seem to get those warnings to go away, even with tsconfig's skipLibCheck. I don't see anything obviously incorrect in the generated type definitions. Attached below, my simple demo project consuming this dependency:

wasm-pack-repro.zip

🤔 Expected Behavior

TypeScript should compile projects depending on wasm-pack output without warnings, or with a usable way to disable warnings.

👟 Steps to reproduce

From the sample ZIP above, run:

yarn
yarn dev

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: 0.10.0
rustc version: 1.49.0

@donmccurdy
Copy link
Author

Possibly related: rustwasm/wasm-bindgen#2200

@leonbotros
Copy link

I'm running into the same issue. @donmccurdy, did you find a fix?

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

2 participants