mirror of
https://github.com/bdnugget/jor1k.git
synced 2026-11-07 04:27:27 +00:00
This achieves consistency with the require calls used throughout the source code. This also makes it easier to use the modules with RequireJS. One way to use RequireJS with CommonJS-style modules is by wrapping them inside an AMD-style wrapper. The CommonJS Loader Plugin for RequireJS (https://github.com/guybedford/cjs) does this. However, RequireJS automatically appends ".js" to the module path, which means a call such as "require('../messagehandler.js')" makes RequireJS look for the file "../messagehandler.js.js", which is clearly invalid. The simplest solution is to avoid the ".js" altogether, which makes the path compatible with both Browserify and RequireJS. The CJS plugin takes care of the rest. neelabhg/sysbuild@8f1764c3d5 details the motivation for supporting RequireJS.