omsmith / browserify-ngannotate

57 stars 7 forks source link

Issue when combined with partialify #4

Closed thebuilder closed 10 years ago

thebuilder commented 10 years ago

I'm using partialify to require() a .json file in my project, but this causes browserify to fail if also add the browserify-ngannotate transform.

I'm guessing ngannotate tries to process the .json file, and fails. Could it be configured to only process .js files? Or just skip the file if it fails to parse it.

Error: /src/views/data/data.json
error: couldn't process source due to parse error
Line 2: Unexpected token :
at Transform.flush [as _flush] (/node_modules/browserify-ngannotate/index.js:29:7)
at Transform.<anonymous> (/node_modules/browserify-ngannotate/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:135:12)
at Transform.g (events.js:175:14)
at Transform.EventEmitter.emit (events.js:117:20)
at finishMaybe (/node_modules/browserify-ngannotate/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:372:12)
at endWritable (/node_modules/browserify-ngannotate/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:379:3)
at Transform.Writable.end (/node_modules/browserify-ngannotate/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:357:5)
at DuplexWrapper.onend (/node_modules/browserify/node_modules/module-deps/node_modules/duplexer2/node_modules/readable-stream/lib/_stream_readable.js:530:10)
at DuplexWrapper.g (events.js:175:14)
at DuplexWrapper.EventEmitter.emit (events.js:117:20)
cdekok commented 10 years ago

I am having the same problem :( When i turn them around in in the array it does not seem to be doing anything but it doesn't fail

thebuilder commented 10 years ago

Uglifyify handles this nicely, by allowing you to define file extensions to process: https://github.com/hughsk/uglifyify#file-extensions

omsmith commented 10 years ago

Published 0.1.0, allowing you to specify file extensions and defaults to just .js.

Let me know!

omsmith commented 10 years ago

Closing this off. Let me know if you have any more issues @thebuilder and @Mech7