Amplify-js: Include src/ files in npm release (for resolving source maps)

Created on 2 Dec 2018  路  4Comments  路  Source: aws-amplify/amplify-js

Is your feature request related to a problem? Please describe.

I am using parcel to bundle a JS project using aws-amplify and also aws-amplify-react. When parcel loads the amplify libraries, it finds source maps, but then fails to find the related sources in the node_modules folder:

鈿狅笍 Could not load source file "../../src/Providers/index.ts" in source map of "../node_modules/@aws-amplify/interactions/lib/Providers/index.js".

I checked the node_modules/@aws-amplify/ folder and all src/ directories are empty鈥擨 must assume the way the project is packaged excludes them.

Describe the solution you'd like

I would like for the src directories to be included in the npm package. This way my bundler can find the source files and give me better error messages if things break.

I think the bundler will successfully exclude those files when it builds the app from production too. So it shouldn鈥檛 be any additional file size load on the actual released app.

Describe alternatives you've considered

I see one other workaround that some people have turned off loading of source maps from their node_modules/ directory: https://github.com/aws-amplify/amplify-js/issues/433#issuecomment-372723436 , however, I think it would be more robust to include the sources for people who want them.

Build feature-request

Most helpful comment

@manueliglesias - I just submitted PR #2680 that should fix this problem by removing src/** from the .npmignore file of 13 Amplify packages that previously had been omitting source code from npm.

FYI @dabit3, @ArmorDarks, @roborourke, @mrcoles

All 4 comments

@mrcoles Thanks for using the library and for the feature-request/enhancement!

I've labeled the issue so we can plan it fo r a future release

I believe that this is also important for debugging in VS Code and other IDEs.

FWIW, after I posted the comment above 10 days ago, I wasted 2 hours in the debugger trying to step-through the AWS client SDK code before I found the root cause in my code. It's incredibly hard to step through transpiled async/await code without sourcemaps to help.

@manueliglesias - I just submitted PR #2680 that should fix this problem by removing src/** from the .npmignore file of 13 Amplify packages that previously had been omitting source code from npm.

FYI @dabit3, @ArmorDarks, @roborourke, @mrcoles

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oste picture oste  路  3Comments

guanzo picture guanzo  路  3Comments

ldgarcia picture ldgarcia  路  3Comments

lucasmike picture lucasmike  路  3Comments

benevolentprof picture benevolentprof  路  3Comments