Giter Club home page Giter Club logo

shadow-cljs-broken-node-source-maps's Introduction

Wrong source maps for node-script?

Some additional notes:

  • It doesn't seem to make a difference whether exceptions are caught in CLJS code or at the node process level
  • Much of this relies on the accuracy of sourcemap.clj as this is what I'm using to verify if source maps are working. I first discovered this issue in Sentry where source maps also were wrong (matching the output of sourcemap.clj, so I think it's likely accurate).

Make a release build {:target :node-library} with :simple optimizations

~/c/0/source-map-repro (off) (master) npx shadow-cljs release main
shadow-cljs - config: .../source-map-repro/shadow-cljs.edn  cli version: 2.8.74  node: v10.16.3
[:main] Compiling ...
[:main] Build completed. (42 files, 3 compiled, 0 warnings, 28.67s)

Run it and note line numbers:

~/c/0/source-map-repro (off) (master) node out/main.js
Error: Whoops
    at Object.source_maps.core.something_that_throws (.../source-map-repro/out/main.js:2295:228)
    at .../source-map-repro/out/main.js:2295:328
    at .../source-map-repro/out/main.js:5:22
    at Object.<anonymous> (.../source-map-repro/out/main.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

Look up source map locations (they seem wrong?)

~/c/0/source-map-repro (off) (master) clj sourcemap.clj out/main.js.map 2295 228
;; out/main.js.map line 2295 col 228
{:original "shadow/cljs/constants/main.js", :line 1, :column 1}
~/c/0/source-map-repro (off) (master) clj sourcemap.clj out/main.js.map 2295 328
;; out/main.js.map line 2295 col 328
{:original "shadow/cljs/constants/main.js", :line 1, :column 1}
~/c/0/source-map-repro (off) (master) clj sourcemap.clj out/main.js.map 5 22
;; out/main.js.map line 5 col 22
nil
~/c/0/source-map-repro (off) (master) clj sourcemap.clj out/main.js.map 9 3
;; out/main.js.map line 9 col 3
nil

shadow-cljs-broken-node-source-maps's People

Contributors

martinklepsch avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.