On Tue, Mar 29, 2022 at 3:54 PM Yadd <[email protected]> wrote: > Hi all, > > some packages, especially those from Sindre Sorhus, changed both: > * language from commonjs to ECMA only ("type": "module") > * API: > const foo = require("foo"); // gives also foo.bar > becomes: > import { foo, fooBar } from "foo"; > > I build new node-find-up, node-chalk (exp) and node-globy (exp) > following this: > * build commonjs file using rollup > * add an index.cjs file which keeps old and new API > * modify package.json to replace "type=module" by an extended "exports" > > Since new module is "type=module" then we are sure that no reverse > dependency will call it using "require" but wanted new behavior. This > permits to have a transition: node-find-up for example seems usable for > any reverse dependency. Only package which are built from ECMA but > wanted old version could have their build broken. >
Awesome ! The author of these packages is pushing too hard to use es modules...
-- Pkg-javascript-devel mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel
