mattdiamond / Recorderjs

A plugin for recording/exporting the output of Web Audio API nodes
4.16k stars 1.46k forks source link

Mime type error with Meteor and Recorder.js Web Worker in Production Mode #31

Closed bnewland closed 11 years ago

bnewland commented 11 years ago

I'm using Recorder.js with Meteor for client-side audio recording, and it works wonderfully in development. However, when I run in production, the web worker associated with Recorder throws a syntax error:

unexpected token '<'.

I think it has something to do with concatenation of Javascript files in production mode, because the file has already been minified (works in development after minifying). A look at the development console shows,

Resource interpreted as Script but transferred with MIME type text/html: "http://myapp:3000/client/compatibility/recorderWorker.min.js".

I know this probably has to do with Meteor's router rather than your library, which has been a great help by the way, but any help would be really appreciated.

jaredfolkins commented 11 years ago

If I were you I'd start your research over at the meteorjs site. I've never used it but I would think they should have documentation on how to bundle/package your external js files for use on production.

Personally I prefer to use grunt and just package up all my crap at the same time and push to staging that way.

Hope this helps.

Jared

On Wed, Aug 21, 2013 at 9:25 AM, bnewland notifications@github.com wrote:

I'm using Recorder.js with Meteor for client-side audio recording, and it works wonderfully in development. However, when I run in production, the web worker associated with Recorder throws a syntax error:

unexpected token '<'.

I think it has something to do with concatenation of Javascript files in production mode, because the file has already been minified (works in development after minifying). A look at the development console shows,

Resource interpreted as Script but transferred with MIME type text/html: " http://myapp:3000/client/compatibility/recorderWorker.min.js".

I know this probably has to do with Meteor's router rather than your library, which has been a great help by the way, but any help would be really appreciated.

— Reply to this email directly or view it on GitHubhttps://github.com/mattdiamond/Recorderjs/issues/31 .

bnewland commented 11 years ago

Meteor's docs are pretty unhelpful, as far as this is concerned. I've read them through quite a few times, and external libraries not written according Meteor's namespacing rules for the client are placed in the 'client/compatibility/recorderWorker" folder, which works. However, there are at least a few conversations on the subject of concatenation at deployment that seems to break a file. Arguably, it's a great feature, but being able to exclude some files (especially those that are already minified) from this would be great. As for Grunt, I've only tinkered with it a bit, because Melon.js depends on it, so I don't really have a comparison between the two.

jaredfolkins commented 11 years ago

"but being able to exclude some files (especially those that are already minified) from this would be great."

This is a solid use case for Grunt. I hope I'm not side tracking you too bad, but I really do enjoy Grunt's flexibility and power.

Jared

On Wed, Aug 21, 2013 at 10:38 AM, bnewland notifications@github.com wrote:

Meteor's docs are pretty unhelpful, as far as this is concerned. I've read them through quite a few times, and external libraries not written according Meteor's namespacing rules for the client are placed in the 'client/compatibility/recorderWorker" folder, which works. However, there are at least a few conversations on the subject of concatenation at deployment that seems to break a file. Arguably, it's a great feature, but being able to exclude some files (especially those that are already minified) from this would be great. As for Grunt, I've only tinkered with it a bit, because Melon.js depends on it, so I don't really have a comparison between the two.

— Reply to this email directly or view it on GitHubhttps://github.com/mattdiamond/Recorderjs/issues/31#issuecomment-23035281 .

bnewland commented 11 years ago

Not a side track. It's worthwhile to know my alternatives. Wish I had known about this a few thousand lines ago, though. HAHAHA