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.

Source maps not working?

See original GitHub issue

🐛 bug report

I’m trying to move my application from next.js & webpack over to using parcel.

Everything seems to be working except there’s 1 random new error that wasn’t happening on next.js but is happening with the parcel & it’s breaking my application.

uncaught at  at  
 at  
TypeError: (0 , n.default) is not a function
    at http://localhost:3000/src.3248ba16.js:1280:1722
    at http://localhost:3000/src.3248ba16.js:1280:1415
    at Object.next (http://localhost:3000/src.3248ba16.js:1280:1520)
    at K (http://localhost:3000/src.3248ba16.js:1218:4337)
    at E (http://localhost:3000/src.3248ba16.js:1218:4062)
    at F (http://localhost:3000/src.3248ba16.js:1218:7973)
    at P (http://localhost:3000/src.3248ba16.js:1218:6802)
    at http://localhost:3000/src.3248ba16.js:1218:8536
    at Array.forEach (<anonymous>)
    at W (http://localhost:3000/src.3248ba16.js:1218:8509)

The actual error totally makes sense. It seems like switching to Parcel has somehow screwed up an import 🤔?

But ALL the stack traces are minified code with no source maps… Making this extremely difficult to debug.

🎛 Configuration (.babelrc, package.json, cli command)

.babelrc

{
    "presets": ["@babel/preset-env", "@babel/preset-react"],
    "plugins": [
        ["@babel/plugin-proposal-class-properties", { "loose": true }],
        "styled-components",
        [
            "module-resolver",
            {
                "root": ["."],
                "alias": {
                    "common": "./src/common",
                    "components": "./src/components",
                    "pages": "./pages",
                    "static": "./static",
                    "theme": "./src/theme",
                    "redash": "./redash"
                }
            }
        ]
    ]
}

Parcel command I’m running:

export NODE_OPTIONS=--max-old-space-size=8192; parcel ./src/index.html --port 3000

🤔 Expected Behavior

Should generate all source maps in development mode, and show a useful stacktrace.

😯 Current Behavior

No source maps are available

💁 Possible Solution

No clue.

🌍 Your Environment

“parcel-bundler”: “^1.12.4”

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
philtunecommented, Jul 8, 2020

Hi, I’m having the same issue. There is no setting to tell the compiled JS files where to look for the source map. /js/scripts.min.js just has //# sourceMappingURL=/scripts.min.js.map, but it needs to be /js/scripts.min.js.map or else needs to just be relative (no leading slash, which makes the most sense) //# sourceMappingURL=scripts.min.js.map

0reactions
brandon-okert-hscommented, Jul 2, 2021

@jessabyrne https://parceljs.org/cli.html#set-the-public-url-to-serve-on eg: parcel build ./web/assets/js/main.js --out-dir ./build/assets --public-url /assets

Assuming you host your assets on eg yoursite:port/assets/main.js

Not sure if updating the docs here is the right place to add some clarification.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Reasons Why Your Source Maps are Broken
4 Reasons Why Your Source Maps are Broken · Missing or incorrect source map directive · Missing original source files · Bad source...
Read more >
Source Maps not working with Webpack
In bundle.js you will see original transpiled webpack bundle - this is normal behaviour. Open webpack:// and you will see your project files ......
Read more >
Source Map Troubleshooting
To enable source maps for these projects, go to Settings -> Advanced -> Migrations and enabled source maps by default.
Read more >
DevTools failed to load source map - Microsoft Q&A
48h ago, my Sharepoint online apps suddenly stopped working. I see this error in the browser console: DevTools failed to load source map: ......
Read more >
The source maps don't work in Developer Tools when ...
When I inspect my Android device using Developer Tools and the exact same source code, the javascript source map isn't extracted and I...
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