-
Bug
-
Resolution: Fixed
-
Major
-
3.9.21, 3.11.14, 4.0.8, 4.1.3, 4.2, 4.3
On MDL-77995, the functon 'babelRename' was changed to:
{{
const babelRename = function(destPath, srcPath) {
const path = require('path');
destPath = srcPath.replace(`amd${path.sep}src`, `amd${path.sep}build`);
destPath = destPath.replace(/\.js$/, '.min.js');
return destPath;
};
}}
However, 'grunt' always uses the forward slash and so on Windows that uses a backslash (as would be seen in the path separator variable) then the 'build' files end up in the 'src' folder and not the 'build' folder.
This can be evidenced by changing the code to:
{{
const babelRename = function(destPath, srcPath) {
const path = require('path');
console.log(srcPath);
destPath = srcPath.replace(`amd${path.sep}src`, `amd${path.sep}build`);
console.log(destPath);
destPath = destPath.replace(/\.js$/, '.min.js');
return destPath;
};
}}
then with the Adaptable theme installed (on Windows) - https://moodle.org/plugins/theme_adaptable/401.1.5/29152 - run the command (either in cmd.exe (right in screenshot) or the Node.js Command Prompt(left in screenshot)) in the Moodle root -> 'grunt amd --root=theme\adaptable' and observe what the code sees in its strings and the resulting build files in the src folder:
The fix / workaround is simply:
destPath = srcPath.replace(`amd/src`, `amd/build`);
- is a regression caused by
-
MDL-77995 Building JS modules with Grunt doesn't work if dirroot contains "/src"
- Closed
- links to