Search code examples
javascriptractivejs

Upgrading from Ractive.js v0.5.8 to v0.7.1 and making a call to file Ractive.js.map


I am upgrading an application from Ractive JS v0.5.8 to v0.7.1 and in the browser console, I am getting a 403 (Forbidden) request calling:

http://[mydomain.com]/www/RACTIVE/ractive/.gobble-build/02-babel/1/Ractive.js.map 

What is causing this request, and how do I remedy it?


Solution

  • That's odd - the final line of ractive.js (and the other files) is this:

    //# sourceMappingURL=ractive.js.map
    

    In other words, an instruction for the browser to fetch the sourcemap if the console is open, and use that for debugging.

    The request you're seeing is for a file that was generated during the build process. We'll remove those intermediate sourcemap comments in the next release (the bundling tool, esperanto, has an open issue for this), but in the meantime it looks like that final comment is being stripped out of the file you're using somehow?

    Three things that should fix it:

    • ensure that the comment shown above is present in your copy of ractive, and place the sourcemap alongside it, or
    • use the minified version, which doesn't have those comments, or
    • manually remove the comments (find and replace /\/\/# sourceMappingURL=.+/ with empty lines

    If the correct comment is present at the end of the file you've using, I'd be curious to know what browser you're in, and how you installed ractive. Thanks