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 #113

Closed
gabrielcarneiro97 opened this issue Apr 26, 2018 · 2 comments
Closed

Module not found: Error: Can't resolve #113

gabrielcarneiro97 opened this issue Apr 26, 2018 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@gabrielcarneiro97
Copy link

I'm testing the wasm-pack with a project that I'm doing of implement Conway's in WASM. Everything went well when I was packing the Rust with wasm-pack, after packing I published it on npm (it can be found here), but when I tried to use the pack in my js project this error has been thrown:

ERROR in ./index.js
Module not found: Error: Can't resolve 'conways_game_of_life' in 'C:\Users\Gabriel\Projetos\Conways-Game-of-Life\wasm-test'
 @ ./index.js 1:11-42

index.js:

import * as wasm from 'conways_game_of_life'

// At moment I'm just trying to see what is imported
console.log(wasm)

The RUST code is here, it is working when I use it as the hello world exemple of wasm-bindgen, with import(...).

How am I supposed to import packages generated by wasm-pack?

@gabrielcarneiro97
Copy link
Author

I soved it, the wasm-pack doesn't create the index.js file, so i need to require an expecific file, the correct import is const wasm = import('conways_game_of_life/conways_game_of_life')

@mgattozzi
Copy link
Contributor

Yeah this was resolved by #94 and should be in the next release :)

@mgattozzi mgattozzi added the duplicate This issue or pull request already exists label Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants