mingo: mingo@6.2.2 breaks CommonJS requires of files inside package
mingo@6.2.2 (874ab58ee60aa6b2d3c4f95cce1f819d047a4925) introduced a likely-accidental breaking change to mingo’s published library structure, moving output JS files underneath lib/
.
This means the CommonJS require
examples from the README using child files, which worked in mingo@6.2.1, no longer work in mingo@6.2.2:
> const core = require("mingo/core");
Uncaught Error: Cannot find module 'mingo/core'
It also roughly doubles the package size, since there are now two copies of the JS output, under lib/
and es/
.
Would you be ok with unpublishing or deprecating 6.2.2 + reverting until the breaking change can be addressed?
If you haven’t seen it already, the Node docs have advice on writing packages that can be natively used from both CommonJS modules and ES Modules environments. I haven’t tried it myself, but it seems to be thorough. https://nodejs.org/docs/latest-v12.x/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 20 (19 by maintainers)
@kofrasa I am working on a PR.
Setting
sideEffects: false
on the root package.json does not seem correct. For example the code fills up the operators in the init here https://github.com/kofrasa/mingo/blob/master/src/init/system.ts which is a side effect because it directly runs on import and mutates a “global” state. The bundler would tree-shake out the system.ts which would then no longer work.Gotcha. I have verified the bug. Deprecating version
6.2.2
for now.Sorry for the breaking change. I tested both using
require
for CommonJS module andimport
for ES6 modules. Perhaps there was something amiss there. I will deprecate this version for now.