Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source maps specified in index.js but not included in blade #382

Closed
johanobergman opened this issue Nov 29, 2020 · 5 comments · Fixed by #395
Closed

Source maps specified in index.js but not included in blade #382

johanobergman opened this issue Nov 29, 2020 · 5 comments · Fixed by #395
Assignees
Labels
enhancement in progress We're working on it

Comments

@johanobergman
Copy link

Description

The dist js files specify a sourceMappingUrl, but since no source maps are included in blade it results in a developer console error, 404 for index.js.map.

Proposed solution

Either completely skip source map in the build, or include them as part of the @routes directive (but then - should they be included in production or not?). Perhaps users could import the js using their build tool (leaving source map generation up to them), while using blade only for the JSON routes.

@bakerkretzmar
Copy link
Collaborator

I like the idea of inlining them in non-production environments, they're bigger than Ziggy itself but still relatively tiny overall. Microbundle doesn't seem to support this but Rollup does and it looks straightforward, so I might PR it.

As for using @routes just for the JSON, if I'm understanding you correctly, this should already be possible with the ziggy.skip-route-function config option.

@andreasnij
Copy link

@bakerkretzmar This seems more like a bug than an enhancement to me. We are using @routes and the route helper and since updating Ziggy we are getting warnings in the developer console on all pages where Ziggy is used, in production. Please consider relabeling this issue so it might get a higher priority.

DevTools failed to load SourceMap: Could not load content for https://www.example.com/index.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

@bakerkretzmar bakerkretzmar self-assigned this Dec 18, 2020
@bakerkretzmar
Copy link
Collaborator

My PR to add support for inline sourcemaps was just merged into microbundle, so as soon as they tag a release this should be trivial to add. Thanks for your patience.

Note to future me: in production just strip out the sourcemap line entirely to avoid error messages.

@graceoflives
Copy link

Hi. I am using Safari and adding @routes to blade make pages unable to load anything because Safari returns a 404 error on sourcemaps "index.js.map".
I have fixed it temporarily by creating a dummy index.js.map file.
Please consider release the merged fix. Thank you for the awesome lib.

@bakerkretzmar
Copy link
Collaborator

@graceoflives just released v1.0.5 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement in progress We're working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants