question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: (0 , js_tokens_1.default) is not a function

See original GitHub issue

console.log(Array.from(jsTokens('Привет, а?'))); ^ TypeError: (0 , js_tokens_1.default) is not a function

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lydellcommented, Dec 11, 2022
❯ node -v
v19.2.0

❯ yarn add js-tokens
yarn add v1.22.19
warning ../../package.json: No license field
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...

success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ js-tokens@8.0.0
info All dependencies
└─ js-tokens@8.0.0
✨  Done in 0.32s.

❯ cat test.mjs
// import { NestFactory } from '@nestjs/core';
// import { AppModule } from './app.module';
// import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
// import { json, urlencoded } from 'express';
// import * as morgan from 'morgan';
import jsTokens from 'js-tokens';

console.log(Array.from(jsTokens('Привет, а?')));

❯ node test.mjs
[
  { type: 'IdentifierName', value: 'Привет' },
  { type: 'Punctuator', value: ',' },
  { type: 'WhiteSpace', value: ' ' },
  { type: 'IdentifierName', value: 'а' },
  { type: 'Punctuator', value: '?' }
]
0reactions
pavlyutkincommented, Dec 11, 2022

Sorry, the problem was solved by adding "esModuleInterop": true in tsconfig.json https://www.typescriptlang.org/tsconfig#esModuleInterop

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: (0 , o.default) is not a function
It seems to be import statement somewhere in your file is incorrect. Example: (from an issue) // fails import combineReducers from "redux" ...
Read more >
TypeError: (0 , n.default) is not a function #3970 - GitHub
I'm out of ideas how to solve this so I hope someone on here can help. Full error: TypeError: (0 , n.default) is...
Read more >
typeerror: (0 , express_1.default) is not a function - You.com
I'm getting [TypeError: (0 , express_1.default) is not a function for my code. import express from "express"; const app = express (); //...
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
(0 , import_defineToJSON.default) is not a function - Bugs
When trying to import '@8base/auth' to a Vite+Vue 3 project, the following error is trigger by the import statement. Uncaught TypeError: (0 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found