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

543 Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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';

0
On

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