grunt-requirejs
grunt-requirejs copied to clipboard
Can't get replaceRequireScript working
I'm attempting to insert my pkg.version into the modulePath (to avoid caching), but the package name just keeps defaulting to the 'data-main' of the original script tag.
This code worked before (about 2 months ago), but has broken since I last tried it, I assume due to 78a3ec56506cdcfe30588a303b07d5f104562cf6 - it looks like 'file.modulePath' isn't returning anything (line 42 of replace.js).
Oddly, the file is named correctly - it's just the script tags that aren't updated properly.
options: {
name: 'main',
mainConfigFile: 'web/app/main.js',
out: 'temp/app/<%= pkg.version %>.js',
preserveLicenseComments: false,
almond: true,
replaceRequireScript: [{
files: ['temp/index.html'],
module: 'main',
modulePath: '/app/<%= pkg.version %>'
}]
}
Thanks for the detailed report. Do you think you could be coming up with a PR & in case you're not able to, at least a failing unit test so that someone else is able to tackle the issue?!
Thanks.
+1. I'd put exact same config after a lot of research and it finally worked two months ago. Not anymore...
Adding @nitinhayaran to the thread who authored above change.
Can someone please confirm if the issue persists in current master. There was some issue with use of modulePath in https://github.com/asciidisco/grunt-requirejs/commit/78a3ec56506cdcfe30588a303b07d5f104562cf6 but that was fixed in https://github.com/asciidisco/grunt-requirejs/commit/940e41d5fdb9bee9b97c49b7c47b7ff9996e0431
This issue seems to have been fixed by ec2691fede14ebc82a75a3f021806629527da23c