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: Can't resolve xxxx #100

Closed
harpal-hp opened this issue Apr 24, 2020 · 11 comments
Closed

Module not found: Can't resolve xxxx #100

harpal-hp opened this issue Apr 24, 2020 · 11 comments
Labels

Comments

@harpal-hp
Copy link

harpal-hp commented Apr 24, 2020

Describe the bug
using serverless framework and trying to transform the xml using template. getting error Module not found for asm2wasm, env, global, along with below error -
WebAssembly module is included in initial chunk.
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
Add an async splitpoint (i. e. import()) somewhere between your entrypoint and the WebAssembly module:

Minimal Script To Reproduce
running sls offline in serverless project

const { transform } = require('camaro')
// your code
  let result = await transform(data, {
     data : ['xxx,xxx', {
          processDate: 'xxx',
          effectiveDate: 'xxx',
          tranSubCode: 'xxxx',
}]
[camaro-issue.txt](https://github.com/tuananh/camaro/files/4531879/camaro-issue.txt)




**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

- camaro version: 4.1 , 4.2 
- Node version:  10.x , 12.x
- Operating system: win10
@harpal-hp
Copy link
Author

Issue is with only server-less framework node JS lambda project, working fine with plain node JS project

@tuananh
Copy link
Owner

tuananh commented Apr 25, 2020

Can you create a minimal repro repo so that I can clone and check the error? Also, what command to use to reproduce it.

@tuananh
Copy link
Owner

tuananh commented Apr 25, 2020

It seems to be problem with serverless framework where it tries to parse wasm file. The way I can see is either config serverless to not to do that. Or I can fix it at camaro project where I remove wasm file and place its content directly in js file.

Just my hypothesis.

@tuananh
Copy link
Owner

tuananh commented Apr 25, 2020

@harpal-hp this looks similar with this issue. update the webpack config to ignore wasm.

serverless-heaven/serverless-webpack#386

@harpal-hp
Copy link
Author

Ok, i will try to do that. i have created the repo if you want to replicate the issue -

https://github.com/harpal-sgh/serverless-camaro

Run : npm i then sls offline, you might have to install serverless if not installed already

@harpal-hp
Copy link
Author

I tried ignoring .wasm file, but i am losing serverless-bundle capabilities. i have to bundle it using web-pack.
If you can do something in Camaro project, it will be great help for everyone, who want to use Camaro library with server-less framework.

Thanks

@tuananh
Copy link
Owner

tuananh commented Apr 26, 2020

I tried ignoring .wasm file, but i am losing serverless-bundle capabilities. i have to bundle it using web-pack.
If you can do something in Camaro project, it will be great help for everyone, who want to use Camaro library with server-less framework.

Thanks

it's possible. lemme take a look into it.

@harpal-hp
Copy link
Author

@tuananh do you know how long it will take to fix this?

@tuananh
Copy link
Owner

tuananh commented May 2, 2020

@harpal-hp i'm working on it. thought it would be straight forward but somehow, it still doesn't work yet :D. maybe another week or two, depends on how i can manage my time.

@tuananh
Copy link
Owner

tuananh commented May 28, 2020

Recently, I chose to use worker_threads for performance gain so web support is dropped.

i'm looking for way to re-add it in the future but I don't know how yet. So this won't be fixed anytime soon.

@tuananh tuananh closed this as completed May 28, 2020
@jonsherrard
Copy link

For googlers:

Just a not that worker_threads means this won't work on platforms that don't support Node 12. For example Google Cloud Functions.

(Check node -v locally if you're having working errors)

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

No branches or pull requests

3 participants