ternjs / tern

A JavaScript code analyzer for deep, cross-editor language support
https://ternjs.net/
MIT License
4.25k stars 378 forks source link

acorn-lose error with tern 0.23.3 or up #1044

Open oeddyo opened 3 years ago

oeddyo commented 3 years ago

Hi @marijnh

First of all thanks for this amazing software (and many other things like CM)!

I just found that if you use tern with version 0.23.3 and up in react project, it will report an error as below. If I downgrade tern to 0.22 then it's all fine. Could you take a look and see if it's a bug please?

Thanks


Uncaught TypeError: Cannot set property 'tabSize' of undefined
    at Module../node_modules/acorn-loose/dist/acorn-loose.mjs (acorn-loose.mjs:1359)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at infer.js:17
    at Object../node_modules/tern/lib/infer.js (infer.js:22)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at tern.js:9
    at Object../node_modules/tern/lib/tern.js (tern.js:14)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at Module.<anonymous> (store.tsx:18)
    at Module../src/widget/components/code-editor/index.tsx (index.tsx:74)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at Module.<anonymous> (index.tsx:18)
    at Module../src/pages/play-ground.tsx (play-ground.tsx:22)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at Module.<anonymous> (index.css:9)
    at Module../src/app.tsx (app.tsx:21)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at Module.<anonymous> (index.css?bb0a:82)
    at Module../src/index.tsx (index.tsx:18)
    at __webpack_require__ (bootstrap:856)
    at fn (bootstrap:150)
    at Object.1 (index.tsx:74)
    at __webpack_require__ (bootstrap:856)
    at checkDeferredModules (bootstrap:45)
    at Array.webpackJsonpCallback [as push] (bootstrap:32)
    at main.chunk.js:1
oeddyo commented 3 years ago
Failed to compile.

./node_modules/acorn-loose/dist/acorn-loose.mjs
Can't import the named export 'Node' from non EcmaScript module (only default export is available)
Ajaya1000 commented 3 years ago

The same happened to me.

ERROR in ./node_modules/acorn-loose/dist/acorn-loose.mjs 1281:30-38
Can't import the named export 'tokTypes' from non EcmaScript module (only default export is available)