Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Any plans for javascript source map support?

      http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

        Activity

        Hide
        tecgoblin added a comment - - edited

        This is super useful feature that works without jawr but is broken with jawr. Source maps are used already by plenty of languages (coffeescript, typescript, less etc). They rely in having a .map file mapping the original file to the generated one.
        Without jawr, the browser reads a comment in the generated file and this comment tells where to look for the mapping, which in turn leads to the original file.
        In my example, I have a .js with the following automatically generated comment: //# sourceMappingURL=MyFile.js.map
        With jawr, the .map file cannot be put in the js bundle, so it has to be treated as an orphan resource. The .js file served is NOT anymore in the same path as the .map file, so the browser cannot find the .map file.
        Other bundling frameworks (see asp.net built-in bundling) are completely transparent on debug (by not changing the urls), so they manage to overcome this issue.

        Show
        tecgoblin added a comment - - edited This is super useful feature that works without jawr but is broken with jawr. Source maps are used already by plenty of languages (coffeescript, typescript, less etc). They rely in having a .map file mapping the original file to the generated one. Without jawr, the browser reads a comment in the generated file and this comment tells where to look for the mapping, which in turn leads to the original file. In my example, I have a .js with the following automatically generated comment: //# sourceMappingURL=MyFile.js.map With jawr, the .map file cannot be put in the js bundle, so it has to be treated as an orphan resource. The .js file served is NOT anymore in the same path as the .map file, so the browser cannot find the .map file. Other bundling frameworks (see asp.net built-in bundling) are completely transparent on debug (by not changing the urls), so they manage to overcome this issue.
        Hide
        paranoiabla added a comment -

        I tried mapping all the //.js.map to the jawr controller and now when I run jawr in debug=true it all works great, but when I try it in debug=false I get StackOverflow errors. The reason is that JAWR is trying to load this .map file gzip_1463943825/solarapparel/NORMAL/slick.css.map and it hits JawrRequestHandler:86

        					if (LOGGER.isDebugEnabled()) {
        						LOGGER.debug("Path '" + requestedPath
        								+ "' does not belong to a bundle. Forwarding request to the server. ");
        					}
        					request.getRequestDispatcher(requestedPath).forward(request, response);
        					processed = true;
        

        and because it does not belong to a bundle it delegates the request to the server, which calls JAWR again, and again and again. So i guess simply mapping the map file to jawr will not really work.

        Show
        paranoiabla added a comment - I tried mapping all the / / .js.map to the jawr controller and now when I run jawr in debug=true it all works great, but when I try it in debug=false I get StackOverflow errors. The reason is that JAWR is trying to load this .map file gzip_1463943825/solarapparel/NORMAL/slick.css.map and it hits JawrRequestHandler:86 if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Path '" + requestedPath + "' does not belong to a bundle. Forwarding request to the server. " ); } request.getRequestDispatcher(requestedPath).forward(request, response); processed = true ; and because it does not belong to a bundle it delegates the request to the server, which calls JAWR again, and again and again. So i guess simply mapping the map file to jawr will not really work.
        Hide
        icefox added a comment -

        Hi,

        The integration of map support in Jawr is not an easy task.
        Some files are linked to map files (less, coffeescript, ...)
        But these files can be incorporated in bundles, which can be minified.
        The processors can have impact on the map files too...

        So make it work with the different components is not easy.
        This feature is not currently in the top priorities, but it still is considered in the roadmap.

        Any help on this feature is more than welcome.

        Cheers,

        Show
        icefox added a comment - Hi, The integration of map support in Jawr is not an easy task. Some files are linked to map files (less, coffeescript, ...) But these files can be incorporated in bundles, which can be minified. The processors can have impact on the map files too... So make it work with the different components is not easy. This feature is not currently in the top priorities, but it still is considered in the roadmap. Any help on this feature is more than welcome. Cheers,
        Hide
        tecgoblin added a comment -

        @paranoiabla Can you explain what do you mean by 'I tried mapping all the //.js.map to the jawr controller and now when I run jawr in debug=true it all works great'? It might be sufficient for us if it works with debug=true, but in our case we cannot manage to even add the .js.map files to a bundle.

        Show
        tecgoblin added a comment - @paranoiabla Can you explain what do you mean by 'I tried mapping all the //.js.map to the jawr controller and now when I run jawr in debug=true it all works great'? It might be sufficient for us if it works with debug=true, but in our case we cannot manage to even add the .js.map files to a bundle.
        Hide
        icefox added a comment -

        Hi tecgoblin,

        Can you elaborate your use case?
        How would you like it to work in debug mode?

        Handling sourcemap in debug mode could be a first step to achieve this feature.

        Cheers,

        Show
        icefox added a comment - Hi tecgoblin, Can you elaborate your use case? How would you like it to work in debug mode? Handling sourcemap in debug mode could be a first step to achieve this feature. Cheers,
        Hide
        paranoiabla added a comment -

        What I mean is that I simply map the spring jawr controller to map to /*/.js.also. And for that I don't see any exceptions in debug mode. In production mode however I get the exceptions (I think it's because in debug mode my javascript files are not including the .map file)

        Show
        paranoiabla added a comment - What I mean is that I simply map the spring jawr controller to map to /* / .js.also. And for that I don't see any exceptions in debug mode. In production mode however I get the exceptions (I think it's because in debug mode my javascript files are not including the .map file)
        Hide
        tecgoblin added a comment -

        Hi @icefox and thanks for caring! Ideally I would like that in debug mode the page points directly to the original Js paths, as they are in the folder structure. Ex js/thatpage/file1.js instead of /jawr/mybundleforthatpage/file1.js This would allow the browser to find the source.map and source files which are in the same folder.
        If this is not possible, I would like to have jawr doing something similar by searching itself for the sourcemapping comment in the source file, understand there is a source file and expose the source file and the mapping file in a path coherent to what the comment says. So, if the comment points to a Js.map in the same folder as the .js, I would need /jawr/mybundleforthatpage/file1.js, /jawr/mybundleforthatpage/file1.js.map and /jawr/mybundleforthatpage/file1.ts (in this example the source is typescript, but it could be anything). In this case as well the browser will be able to find the source.

        Show
        tecgoblin added a comment - Hi @icefox and thanks for caring! Ideally I would like that in debug mode the page points directly to the original Js paths, as they are in the folder structure. Ex js/thatpage/file1.js instead of /jawr/mybundleforthatpage/file1.js This would allow the browser to find the source.map and source files which are in the same folder. If this is not possible, I would like to have jawr doing something similar by searching itself for the sourcemapping comment in the source file, understand there is a source file and expose the source file and the mapping file in a path coherent to what the comment says. So, if the comment points to a Js.map in the same folder as the .js, I would need /jawr/mybundleforthatpage/file1.js, /jawr/mybundleforthatpage/file1.js.map and /jawr/mybundleforthatpage/file1.ts (in this example the source is typescript, but it could be anything). In this case as well the browser will be able to find the source.

          People

          • Assignee:
            icefox
            Reporter:
            rhuynh
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: