I am trying to use RequireJS inside a web worker. The problem is that I keep getting the following error when using it. Uncaught Error: importScripts failed for underscore at ./lib/underscore.js
I have tested my configuration options, and they only cause this error when importing Underscore. Here they are:
{
baseUrl: './',
paths: {
jquery: 'lib/jquery',
underscore: 'lib/underscore'
},
shim: {
underscore: {
exports: '_'
}
}
}
I can add more info if necessary. The source for this project is on GitHub at https://github.com/isaach1000/canvas.
UPDATE: Still no luck on fixing RequireJS, but I fixed my issue using a Grunt task. Here is the configuration:
requirejs: {
worker: {
options: {
baseUrl: 'js',
name: 'task',
out: 'build/task.js',
paths: {
jquery: 'lib/jquery',
underscore: 'lib/underscore'
},
shim: {
underscore: {
exports: '_'
}
},
include: ['lib/require.js'],
optimize: 'none'
}
}
}