Node: Node 14.13 problematic (default?) import combinations

Created on 3 Oct 2020  路  5Comments  路  Source: nodejs/node

There are some import combinations which do not work together any longer (each import alone works fine)

  • Version:v14.13.0
  • Platform: Darwin mbpMarkus 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
  • Subsystem:

What steps will reproduce the bug?

import recast from "recast";
import lockfile from '@yarnpkg/lockfile';

How often does it reproduce? Is there a required condition?

Always (starting with node 14.13)

What is the expected behavior?

two default exports provided

What do you see instead?

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)

Additional information


Saw the problem with other combinations of imports to

ES Modules confirmed-bug

Most helpful comment

All 5 comments

/cc @nodejs/modules

I verified this can be reproduced in v14.13.0 while it works in v14.12.0.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aduh95 picture aduh95  路  104Comments

egoroof picture egoroof  路  90Comments

thecodingdude picture thecodingdude  路  158Comments

nicolo-ribaudo picture nicolo-ribaudo  路  147Comments

VanCoding picture VanCoding  路  204Comments