Skip to content

stimulus.min.js.map does not match stimulus.min.js #154

@mattbnz

Description

@mattbnz

The sourcemap file shipped by this gem in stimulus.min.js.map does not match the minified javascript in stimulus.min.js and is unable to be used in devtools for standard sourcemap tasks...

Steps to Reproduce:

  1. install this gem in a rails project (using importmaps, but I don't think that's relevant)
  2. Load a page, open devtools, navigate to the minified source
  3. pick a function in the minifed source and double-click in the left gutter (or attempt to set a breakpoint)

Expected Behaviour:

Chrome should jump from the minified source line into the corresponding sourcemap provided source file and set a breakpoint.

Observed Behaviour:

While Chrome can load the sourcemap and show the original source file, the line mapping and relationship between minified source and original source is broken and does not function. Breakpoints cannot be set.

Further verification

Uploading the minified js and map files from this gem (both directly from github and/or downloaded via rails in their hashed form) using either the https://sokra.github.io/source-map-visualization/#custom-choose or https://evanw.github.io/source-map-visualization/ source mpa debugging tools recommended by Chrome at https://web.dev/articles/source-maps#understand shows the brokenness - neither tool is able to successfully map the minified source to the original source.

Downloading stimulus 3.2.2, running yarn build and then copying the resulting dist/stimulus.min.js and dist/stimulus.min.js.map files into app/javascript (to override the gem provided versions) results in a working Chrome DevTools environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions