grunt-requirejs icon indicating copy to clipboard operation
grunt-requirejs copied to clipboard

Can't get replaceRequireScript working

Open Rainbowlemon opened this issue 11 years ago • 4 comments

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 %>'
                    }]
                }

Rainbowlemon avatar Mar 17 '14 20:03 Rainbowlemon

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.

asciidisco avatar Mar 30 '14 21:03 asciidisco

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

sytelus avatar Apr 21 '14 02:04 sytelus

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

nitinhayaran avatar Apr 21 '14 08:04 nitinhayaran

This issue seems to have been fixed by ec2691fede14ebc82a75a3f021806629527da23c

Rainbowlemon avatar Apr 22 '14 21:04 Rainbowlemon