I have a working web app using require.js and I'm trying to have all files be minified and concatenated. I'm using grunt-contrib-requirejs to compile the whole project into a bundle.js file, like so:
requirejs: {
compile: {
options: {
baseUrl: "public/",
mainConfigFile: "config.js",
name: "start",
out: "public/bundle.js",
preserveLicenseComments: false,
}
}
}
Now I've changed my index.html to call the bundle rather than the unbundled start.js entry point:
replaced: <script data-main="start" src="require.js"></script>
with: <script data-main="../bundle.js" src="require.js"></script>
Compilation seems to be doing fine, and bundle.js is indeed found, but I'm getting this error:
Uncaught SyntaxError: ../bundle.js: In strict mode code, functions can only be declared at top level or immediately within another function.
But the chrome debugger shows the error as thrown from require.js. I'm pretty sure there is no mistake in require.js. How can I find which part of my code produces the error?
update This may (or may not) be related to this recent jQuery bug. I can't tell because when I use the non-minified version of jquery, I get another error ("define is not defined") coming from this line: define("jquery", function(){});
. I don't know where this line comes from either, it seems like a strange thing to do...