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.

Loading sourcemaps in a monorepo

See original GitHub issue

I have a mono repo structured like this:

.
├── node_modules
├── package.json
├── packages
│   ├── app
│   │   ├── dist
│   │   │   ├── App.css
│   │   │   ├── App.js
│   │   │   ├── App.js.map
│   │   │   ├── index.js
│   │   │   └── index.js.map
│   │   ├── package.json
│   │   ├── src
│   │   │   ├── App.css
│   │   │   ├── App.js
│   │   │   └── index.js
│   │   └── yarn.lock
│   └── ui
│       ├── node_modules
│       │   └── @taxi
│       │       └── app -> ../../../app
│       ├── package.json
│       ├── public
│       ├── src
│       ├── tsconfig.json
│       └── yarn.lock
├── tsconfig.build.json
├── tsconfig.json
├── tslint.json
├── tslint.prod.json
├── tslint.test.json
├── yarn-error.log
└── yarn.lock

the packages/app/package.json file contains:

{
  "name": "@taxi/app",
  "version": "1.0.0",
  "description": "Main application",
  "private": true,
  "main": "/dist/index.js",
  "license": "MIT",
  "peerDependencies": {
    "react": "^16.5.1",
    "styled-components": "^3.4.6"
  },
  "files": [
    "dist"
  ],
  "dependencies": {
    "react": "^16.8.2",
    "react-dom": "^16.8.2"
  }
}

Peer dependencies (i.e. other packages) are linked into node_modules using lerna link.

packages/app is built with:

BABEL_ENV=build babel src --root-mode upward --out-dir dist --source-maps --extensions .js,.ts,.tsx --no-comments --copy-files

packages/ui is a create-react-app application. The app runs correctly and loads objects from packages/app seemingly fine.

I have sourcemap files for the files in packages/app/dist, but I can’t get create-react-app to appear to use them correctly. I say correctly, since it does appear to be using them (in Chrome), since the debugger is finding the sourcemap and mapping from the webpack hosted chunk file to the file in dist, but I want to map it to the file in src. I’d really like to debug the source and not the transpiled code.

This seems like a pretty common use case, without ejecting, is there something that I can do to get this working?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:10

github_iconTop GitHub Comments

3reactions
ggascoignecommented, Mar 6, 2019

I’ve been looking at the reverted monorepo PRs (#3741, #3997, #4001), which appear to do exactly what I’d have desired. I do understand why they were pulled from V2, but they were reverted with a comment that the issue would be solved by “excellent documentation”, and as yet, I can’t see any, excellent or otherwise.

Can someone who understand how, write some? This is frustrating since my build basically works, but not being able to get sourcemaps working really is a huge stumbling block - and I expect that fixing sourcemaps is specifically an issue with the create-react-app managed webpack config.

0reactions
stale[bot]commented, Jun 13, 2019

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I correctly sourcemap in a multi-package monorepo ...
I have a yarn workspace with two packages. PackageA; PackageB. PackageB depends on PackageA, so there is a symlink in the root node_modules ......
Read more >
Turborepo Quickstart
Create your first monorepo or add Turborepo to an existing project. ... Build a brand-new monorepo with shared packages powered by Turborepo ...
Read more >
Introducing esbuild To Your Monorepo - DEV Community ‍ ‍
I would like dist/esm/index.js to be the entry point, bundle it, minify it and have some source map file to it before putting...
Read more >
Configuring Sentry with JavaScript Source Maps
An epic troubleshooting tale to enable JavaScript source map fetching in Sentry. ... changes for uploading source maps within a few months.
Read more >
Release Management - Sentry Documentation
For instance upon uploading a source map a release is automatically created. Likewise releases are created by some clients when an event for...
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