I have a plugin project, I’m trying to use just-diff in this project. au run is failing on a bundler “writeBundles” error saying that it cannot find the file “…\node_modules\just-diff\index.mjs.js” suggesting to use allowEmpty. It seems like it is tacking “.js” onto the end of the module property of just-diff’s package.json. Has anyone else ever seen this before?
UPDATE:
I was able to get this to work by specifying ‘just-diff/index’ as the import path, still seems like I shouldn’t have to do that though. I assume something about the aurelia-cli bundler doesn’t support dependencies like that? Or maybe just-diff is not configured correctly? Idk
aurelia-cli bundler was designed before nodejs introduced cjs mjs files. It’s not playing with those new files well.
Figured it was something like that. Thanks for replying though!
Running into this issue with multiple libraries that are changing their module files to .mjs
. Has anyone found a good solution to this other than updating all of their imports?
A package alias might solve the issue, but what/where is the “dependency config” though?
CLI + built-in Bundler Advanced | Aurelia
For anyone else running into this issue, I’m having success with modifying the aurelia.json
in the build.bundles.dependencies list. For example, in the latest fast-sort, the module was changed to sort.mjs
. To fix it, I added the following to the dependencies list:
// file: aurelia.json
//...
{
"name": "fast-sort",
"path": "../node_modules/fast-sort/dist/",
"main": "sort.min"
}
1 Like