Skip to content

Sourcemaps with esbuild not working. #73

@ioev

Description

@ioev

I'm actually not sure if this is a problem with jsbundling-rails or bundler, but:

I'm bundling my js/css via esbuild --bundle --watch --sourcemap which results in 2 files being generated in assets/builds, application.js and application.js.map. The application requests these via:
/assets/application.debug-1caabe86ba2a00618598d8d7d5a8fe6c57a594dd7babeec3fe6e3ff3ce9185e1.js
/assets/application.js-4112a73edf43c31165109b2906c7bcda25ff0505d405213d39501087ea154f74.map

The sourcemap url does not exist.

If I look at the bottom of my application.js in the build folder, it ends with:

//# sourceMappingURL=application.js.map

And if I look at the end of the file coming from a server request, it ends with:

//# sourceMappingURL=/assets/application.js-5673ea8258e5021fb9befebfe3f84d5c8ff21ee5fd1e52b4f54b8347a5bbfbbb.map
//!
;

//# sourceMappingURL=application.js-4112a73edf43c31165109b2906c7bcda25ff0505d405213d39501087ea154f74.map

The first source map url works, the second does not. I'm assuming bundler is somehow fixing the existing sourcemap definition, but then also adding it's own?

Running esbuild without --sourcemaps ends up with sourcemaps that work on the client, but they are not useful.

Is there a workflow that will work here?

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