T
T
testopikachu2019-04-09 15:11:22
JavaScript
testopikachu, 2019-04-09 15:11:22

How to disable import of .mjs modules?

Hey!
I have a script that imports a library . The infer library in turn imports another library: And here is the problem with it: When building, I get an error:
import infer from 'tern/lib/infer'
require("acorn-loose")

ERROR in ./node_modules/acorn-loose/dist/acorn-loose.mjs 28:13-17
    Can't import the named export 'Node' from non EcmaScript module (only default export is available)

Its package.json has 2 parameters:
{
  ...
  "main": "dist/acorn-loose.js",
  "module": "dist/acorn-loose.mjs",
  ...
}

If I delete the dist/acorn-loose.mjs file, then the build succeeds.
Tell me how to disable the import of dist/acorn-loose.mjs from the "module" section without interfering with the code of the library itself?
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question