question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include src/ files in npm release (for resolving source maps)

See original GitHub issue

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—I 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’t 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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
justingrantcommented, Feb 9, 2019

@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

1reaction
justingrantcommented, Dec 14, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

source-map-loader - npm
The source-map-loader extracts existing source maps from all JavaScript entries. This includes both inline source maps as well as those ...
Read more >
source-map-support - npm
This module provides source map support for stack traces in node via the V8 stack trace API. It uses the source-map module to...
Read more >
source-map - npm
Generates and consumes source maps. Latest version: 0.7.4, last published: 7 months ago. Start using source-map in your project by running ...
Read more >
gulp-sourcemaps - npm
Inline source maps are embedded in the source file. ... .pipe(gulp.dest('dist'));. };. exports.javascript = javascript;. All plugins between ...
Read more >
convert-source-map - npm
0.0, the fromMapFileComment and fromMapFileSource functions took a String directory path and used that to resolve & read the source map file ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found