Source map support?
richarddd opened this issue · 7 comments
Im getting errors when using aws-crt with aws-iot-device-sdk-v2. When using webpack, I'm getting a lot of Error: ENOENT: no such file or directory
since webpack tries to resolve the original sources from the node_modules/aws-crt/lib/
directory.
I don't know anything about webpack, but the v2 SDK has multiple browser samples (https://github.com/aws/aws-iot-device-sdk-js-v2/tree/main/samples/browser/) that I've been able to use just fine. Is there any difference in their webpack configs that might account for what you're running into?
@bretambrose i have created a reproducer repo here:
https://github.com/richarddd/react-aws-iot-device-sdk-v2
Please see all the warnings of missing typescript files when running yarn start
or npm run start
WARNING in ./node_modules/aws-crt/dist.browser/common/platform.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/user/Projects/react-aws-iot-device-sdk-v2/node_modules/aws-crt/lib/common/platform.ts' file: Error: ENOENT: no such file or directory, open '/Users/user/Projects/react-aws-iot-device-sdk-v2/node_modules/aws-crt/lib/common/platform.ts'
Webpack into non-browser environments ala Electron/React/etc... isn't something we've built support for yet. It's on the roadmap somewhere, but I can't give any dates.
non-browser environments
Not quite sure i follow what you mean by non-browser? This reproducer repo is React for browser only.
It compiles and runs fine, just cant create sourcemap due to missing source files. I'm pretty sure this issue could be solved if this line is removed and sources are published to npm:
https://github.com/awslabs/aws-crt-nodejs/blob/main/.npmignore#L154
My mistake, was thinking more electron there I guess.
@bretambrose I experience the same issue with create-react-app (+ craco), that is same setup.
I think the solution @richarddd proposes might make sense, because it seems that every map file X.js.map
points to "sources" located at "../lib/X.ts"
This should be addressed in v1.15.3