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

🐛 fix Could not load source file warning when bundling with Parcel #535

Merged
merged 2 commits into from
Sep 16, 2020

Conversation

HHogg
Copy link
Contributor

@HHogg HHogg commented Sep 15, 2020

Motivation

The package is building fine with Parcel, but it is leaving a lot of noisy logs due to the src folder being excluded from the published package.

You can replicate this like...

mkdir source-map-example
cd source-map-example
yarn init -y
yarn add parcel @datadog/browser-rum
echo "import { datadogRum } from '@datadog/browser-rum';" > index.js
yarn parcel start index.js

Which you'll see the follow warnings.

⚠️ Could not load source file "../src/index.ts" in source map of "../node_modules/@datadog/browser-logs/esm/index.js".
⚠️ Could not load source file "../src/index.ts" in source map of "../node_modules/@datadog/browser-rum/esm/index.js".
⚠️ Could not load source file "../src/logs.entry.ts" in source map of "../node_modules/@datadog/browser-logs/esm/logs.entry.js".
⚠️ Could not load source file "../src/logger.ts" in source map of "../node_modules/@datadog/browser-logs/esm/logger.js".
⚠️ Could not load source file "../src/rum.entry.ts" in source map of "../node_modules/@datadog/browser-rum/esm/rum.entry.js".
⚠️ Could not load source file "../src/rum.ts" in source map of "../node_modules/@datadog/browser-rum/esm/rum.js".
⚠️ Could not load source file "../src/rumSession.ts" in source map of "../node_modules/@datadog/browser-rum/esm/rumSession.js".
⚠️ Could not load source file "../src/userActionCollection.ts" in source map of "../node_modules/@datadog/browser-rum/esm/userActionCollection.js".
⚠️ Could not load source file "../src/performanceCollection.ts" in source map of "../node_modules/@datadog/browser-rum/esm/performanceCollection.js".
⚠️ Could not load source file "../src/viewCollection.ts" in source map of "../node_modules/@datadog/browser-rum/esm/viewCollection.js".
⚠️ Could not load source file "../src/domMutationCollection.ts" in source map of "../node_modules/@datadog/browser-rum/esm/domMutationCollection.js".
⚠️ Could not load source file "../src/index.ts" in source map of "../node_modules/@datadog/browser-core/esm/index.js".
⚠️ Could not load source file "../src/buildEnv.ts" in source map of "../node_modules/@datadog/browser-logs/esm/buildEnv.js".
⚠️ Could not load source file "../src/lifeCycle.ts" in source map of "../node_modules/@datadog/browser-rum/esm/lifeCycle.js".
⚠️ Could not load source file "../src/buildEnv.ts" in source map of "../node_modules/@datadog/browser-rum/esm/buildEnv.js".
⚠️ Could not load source file "../src/matchRequestTiming.ts" in source map of "../node_modules/@datadog/browser-rum/esm/matchRequestTiming.js".
⚠️ Could not load source file "../src/resourceUtils.ts" in source map of "../node_modules/@datadog/browser-rum/esm/resourceUtils.js".
⚠️ Could not load source file "../src/trackEventCounts.ts" in source map of "../node_modules/@datadog/browser-rum/esm/trackEventCounts.js".
⚠️ Could not load source file "../src/trackPageActivities.ts" in source map of "../node_modules/@datadog/browser-rum/esm/trackPageActivities.js".
⚠️ Could not load source file "../src/getActionNameFromElement.ts" in source map of "../node_modules/@datadog/browser-rum/esm/getActionNameFromElement.js".
⚠️ Could not load source file "../src/loggerSession.ts" in source map of "../node_modules/@datadog/browser-logs/esm/loggerSession.js".
⚠️ Could not load source file "../src/observable.ts" in source map of "../node_modules/@datadog/browser-core/esm/observable.js".
⚠️ Could not load source file "../src/sessionManagement.ts" in source map of "../node_modules/@datadog/browser-core/esm/sessionManagement.js".
⚠️ Could not load source file "../src/init.ts" in source map of "../node_modules/@datadog/browser-core/esm/init.js".
⚠️ Could not load source file "../src/internalMonitoring.ts" in source map of "../node_modules/@datadog/browser-core/esm/internalMonitoring.js".
⚠️ Could not load source file "../src/urlPolyfill.ts" in source map of "../node_modules/@datadog/browser-core/esm/urlPolyfill.js".
⚠️ Could not load source file "../src/utils.ts" in source map of "../node_modules/@datadog/browser-core/esm/utils.js".
⚠️ Could not load source file "../src/cookie.ts" in source map of "../node_modules/@datadog/browser-core/esm/cookie.js".
⚠️ Could not load source file "../src/errorCollection.ts" in source map of "../node_modules/@datadog/browser-core/esm/errorCollection.js".
⚠️ Could not load source file "../src/configuration.ts" in source map of "../node_modules/@datadog/browser-core/esm/configuration.js".
⚠️ Could not load source file "../src/requestCollection.ts" in source map of "../node_modules/@datadog/browser-core/esm/requestCollection.js".
⚠️ Could not load source file "../src/transport.ts" in source map of "../node_modules/@datadog/browser-core/esm/transport.js".
⚠️ Could not load source file "../src/specHelper.ts" in source map of "../node_modules/@datadog/browser-core/esm/specHelper.js".
⚠️ Could not load source file "../src/tracekit.ts" in source map of "../node_modules/@datadog/browser-core/esm/tracekit.js".
⚠️ Could not load source file "../src/oldCookiesMigration.ts" in source map of "../node_modules/@datadog/browser-core/esm/oldCookiesMigration.js".

Changes

Changes the NPM ignore files to include the src folder.

Testing

Rerun the commands given above, but with the src folders and there will be no warnings.


I have gone over the contributing documentation.

@HHogg HHogg requested a review from a team as a code owner September 15, 2020 09:47
@bits-bot
Copy link

bits-bot commented Sep 15, 2020

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2020

Codecov Report

Merging #535 into master will decrease coverage by 0.30%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #535      +/-   ##
==========================================
- Coverage   88.40%   88.10%   -0.31%     
==========================================
  Files          36       36              
  Lines        2286     2286              
  Branches      472      472              
==========================================
- Hits         2021     2014       -7     
- Misses        265      272       +7     
Impacted Files Coverage Δ
packages/rum/src/rum.ts 88.32% <0.00%> (-4.38%) ⬇️
packages/rum/src/performanceCollection.ts 67.14% <0.00%> (-1.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce57cb7...37b67f9. Read the comment docs.

@BenoitZugmeyer BenoitZugmeyer merged commit 9d0d66b into DataDog:master Sep 16, 2020
@BenoitZugmeyer
Copy link
Member

@HHogg thank you for your PR! It will be released as part as the next version.

@HHogg HHogg deleted the fix-parcel-sourcemap-warnings branch September 16, 2020 14:53
@HHogg
Copy link
Contributor Author

HHogg commented Sep 16, 2020

No problem @BenoitZugmeyer and thanks for merging so quickly. Do you have a rough idea when this will be released? (It's a ticket in our sprint, which is now in the blocked column 🙃)

@BenoitZugmeyer
Copy link
Member

Ha, nothing is preventing us to make a small patch release for this. I'll work on this tomorrow!

@BenoitZugmeyer
Copy link
Member

This has been released in 1.20.1. Thanks again!

@HHogg
Copy link
Contributor Author

HHogg commented Sep 18, 2020

Thanks for sorting this out so quickly @BenoitZugmeyer.

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

Successfully merging this pull request may close these issues.

4 participants