andrey-skl / ng-annotate-loader

Webpack loader to annotate angular applications
MIT License
120 stars 28 forks source link

Usage with coffeescript and source maps #7

Closed axelson closed 9 years ago

axelson commented 9 years ago

I may be using webpack wrong but it appears to me that the ng-annotate-loader does not work on coffeescript files if you have source maps enabled. Here are the relevant pieces of my configuration:

devtool: 'eval-cheap-module-source-map',
loaders: [
  { test: /\.coffee$/, loader: 'ng-annotate-loader!coffee-loader', exclude: commonExclude },
]

So I am running the coffeescript loader on the coffeescript files, then running ng-annotate on the resulting javascript files. This results in the error below for every coffeescript file:

ERROR in ../~/raw-loader!../~/ng-annotate-loader/loader.js!../~/coffee-loader!./app/bigscreen/tools/donutChart/donutchart.coffee
Module build failed: Error: "../donutchart.coffee" is not in the SourceMap.
  at SourceMapConsumer_sourceContentFor [as sourceContentFor] (/Users/jason/sift/livesift/node_modules/ng-annotate-loader/node_modules/source-map/lib/source-map/source-map-consumer.js:677:15)
  at SourceMapGenerator.<anonymous> (/Users/jason/sift/livesift/node_modules/ng-annotate-loader/node_modules/source-map/lib/source-map/source-map-generator.js:233:42)
  at Array.forEach (native)
  at SourceMapGenerator_applySourceMap [as applySourceMap] (/Users/jason/sift/livesift/node_modules/ng-annotate-loader/node_modules/source-map/lib/source-map/source-map-generator.js:232:34)
  at Object.module.exports (/Users/jason/sift/livesift/node_modules/ng-annotate-loader/loader.js:47:17)
 @ ../~/script-loader!./app/bigscreen/tools/donutChart/donutchart.coffee 1:80-370

Is there something wrong with my configuration or does this appear to be a bug?

andrey-skl commented 9 years ago

@axelson We had an #6 issue mostly about this. Please try 0.0.6 version, it would help.

axelson commented 9 years ago

Thanks, I didn't realize that issue was related. It's working great now, thanks!