kratiahuja / fastboot-transform

Transforms given broccoli tree that contains browser API to be fastboot complaint
14 stars 7 forks source link

Make changes sourcemap aware, or strip sourcemap comments. #6

Closed rwjblue closed 6 years ago

rwjblue commented 7 years ago

Currently the transform emits a wrapper around the input file contents (to guard when running in fastboot mode). Generally speaking this is good, but it has some issues when the input file contains source map comments inline. As of ember-cli-uglify@2.0.0 any invalid sourcemap comments cause a build time error (we should definitely fix ember-cli-uglify to warn instead of error also).

See:

kratiahuja commented 7 years ago

Hmm I thought we fixed this. I'll take a look at this during the weekend.

andyhot commented 6 years ago

Invalid sourcemap comments don't cause a build error any more but they do generate broken vendor sourcemaps (nothing is mapped)

I'm using the crude approach of https://github.com/andyhot/fastboot-transform/commit/580e205eeee668cecce8bace1427df7f6c95dc7a to get around this.

@rwjblue Would you use a library for stripping the sourcemap comments (didn't find any but didn't search that much) or perhaps a regexp on the last line is fine?

Also, i'm wondering if it makes sense to allow app developers a global switch that turns off this transform (for those not interested in fastboot)

andyhot commented 6 years ago

I ended up creating a nice PR for this using the convert-source-map module