Question

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".

Was it helpful?

Solution

I experienced the same errors/issue while trying to implement Recorder.js in Meteor. After fiddling around with it a bit, I have Recorder.js working well in Meteor by performing the following steps:

  1. Move the recorderWorker.js file to your apps /public folder.

  2. Put your recorder.js file anywhere within your apps /client folder.

  3. Open up your recorder.js file and edit the WORKER_PATH variable to

    var WORKER_PATH = '/recorderWorker.js';

OTHER TIPS

Use the Sources tab in chrome debugger (or your tool of choice) to see the uglified js file, saved it to disk, and poked around in there. There is probably a de-uglifier available somewhere.

Try loading the ugly file in an editor and poking around. At least that's something...

That file is probably present in the .meteor resources, but I've given up before I found it. The create a bundle for production tool should make that more obvious...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top