gulp-requirejs-optimize
gulp-requirejs-optimize copied to clipboard
Requirejs option baseurl doesn't work as expected
I have a multi-module project and the file structure is like below,
/
|-- build
| |-- modules
| | --- moduleA.js // require([a,b,c,d,e...])
| | --- moduleB.js // require([a,b,c,d,e...])
| | --- moduleC.js // require([a,b,c,d,e...])
|-- src
| | --- modules
| |-- components
| | --- a.js
| | --- b.js
| |-- ...
| | --- vendor
| | --- d.js
| | --- e.js
| | --- f.js
And I try to optimize the above js files like below,
gulp.src( "build/modules/*.js").pipe(requirejsOptimize({
baseUrl : "src",
// ....
).pipe(gulp.dest('dist'))
when this task starts there is a log shown as below,
[11:43:10] Optimizing moduleA.js
However, it keeps throwing an error that no such file or directory, open /myfolder/src/moduleA.js .
I am confused about this output. It seems that moduleA.js is found at first step since the above log is printed, but then gulp or this plugin started to look for the file according to baseUrl? How can I make it work? I have to configure baseUrl since all the js codes are located under src/