Coder Social home page Coder Social logo

Source maps about ember-app-kit HOT 6 CLOSED

stefanpenner avatar stefanpenner commented on July 17, 2024
Source maps

from ember-app-kit.

Comments (6)

rwjblue avatar rwjblue commented on July 17, 2024

I've been looking at this, and have a few comments/issues:

We are currently chaining together a number of steps for the javascript to reach the final tmp/public/assets/app.js:

  • copy:prepare copies from app/**/*.js to tmp/javascript/app/
  • transpiler transpiles from tmp/javascript/app/**/*.js to tmp/transpiled/app/
  • emberTemplates:compile compiles templates from app/templates/ to tmp/public/assets/templates.js
  • concat concats all JS from
  • Then additionally for final release we do these tasks:
    • uglify compresses the files identified by useminPrepare
    • rev prepends a hash to the files generated by uglify

In order for our source maps to point back to our original code in app/ we will need each step in the chain to support source maps. (This means that we will have to pass a source map input for everything but the original step.)

Issues with source map support in the current build chain:

  • It doesn't look like es6-module-transpiler supports source maps at this point (although I could have missed it). I am looking to see if I can add support using the mozilla/source_map module.
  • We need to create a source map during the copy:prepare task (coffeescript can already generate a source map on compile) so that we can pass it in to the transpile task.
  • grunt-contrib-concat doesn't support source maps either. There is an alternate that we could use at grunt-concat-sourcemap, but I'm not sure if we want to depend on an external dependency that isn't maintained by the Grunt team...

Another alternative would be to use uglify instead of concat since uglify supports source map in/out and what not. We could tweak the options so that it wouldn't 'mangle' on a standard build (only on build:dist). How do we feel about this in general?

If we either use grunt-concat-sourcemap or uglify to concat, then our only issues are the copy:prepare and es6-module-transpiler.

from ember-app-kit.

kmiyashiro avatar kmiyashiro commented on July 17, 2024

Would it be sufficient first step to add source maps to a step at a time? For example, just before the concat/uglify step so that you can at least debug individual modules in dev?

from ember-app-kit.

thomasboyt avatar thomasboyt commented on July 17, 2024

Going to attempt to include source maps for transpiling during the big Esprima refactor i'm doing. most of it is line-to-line so shouldn't be too bad (knock on wood)

After that, main issue for source maps is concat. grunt-concat-sourcemap should be merged into grunt-contrib-concat ASAP, but in the meantime we may just want to use grunt-concat-sourcemap instead. However, it doesn't currently support piping in existing source maps AFAIK, so that'll have to be added.

from ember-app-kit.

thomasboyt avatar thomasboyt commented on July 17, 2024

Added grunt-concat-sourcemap support in 580525d. Result looks like this:

Better than debugging a single concatenated file, at least.

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

@thomasboyt absolutely, this much better then what we had before. At some point having 1:1 would be great, but this is already a great leap forward.

That being said, I'll leave this issue open until we have the 1:1 solution.

from ember-app-kit.

stefanpenner avatar stefanpenner commented on July 17, 2024

i think leaving the current solution is fine, turns out having debugged a few things. Being able to see the module system preamble, has actually helped me sort or module related issues on many occasions.

I think this can be improved, but for now this seems totally fine.

from ember-app-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.