There are some import combinations which do not work together any longer (each import alone works fine)
import recast from "recast";
import lockfile from '@yarnpkg/lockfile';
Always (starting with node 14.13)
two default exports provided
node issue.mjs
node_modules/recast/lib/lines.js:580
assert_1.default.ok(tabWidth || tabless, "No tab width specified but encountered tabs in string\n" + string);
^
TypeError: assert_1.default.ok is not a function
at fromString (node_modules/recast/lib/lines.js:580:22)
at Object.<anonymous> (/node_modules/recast/lib/lines.js:654:18)
at Module._compile (internal/modules/cjs/loader.js:1085:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:791:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (node_modules/recast/lib/parser.js:11:15)
at Module._compile (internal/modules/cjs/loader.js:1085:30)
Saw the problem with other combinations of imports to
/cc @nodejs/modules
I verified this can be reproduced in v14.13.0 while it works in v14.12.0.
Reverting https://github.com/nodejs/node/pull/35249 fixes it.
The TypeError: assert_1.default.ok is not a function error is thrown because in node_modules/recast/lib/lines.js, require('assert') returns an empty object instead of the assert module.
I can confirm fixed with 14.13.1
Most helpful comment
PR at https://github.com/nodejs/node/pull/35500.