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.

VSCode Error - SyntaxError: Named export 'isIdentifier' not found.

See original GitHub issue

Describe the bug

Currently seeing

SyntaxError: Named export 'isIdentifier' not found. The requested module '@babel/types' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@babel/types';
const { isVariableDeclarator, isIdentifier, isTemplateLiteral, isImportDefaultSpecifier, isImportSpecifier } = pkg;

In all Svelte files when using a custom plugin.

To be clear, the plugin works 100% as expected. The only problem here is the error message in VSCode.

To Reproduce Steps to reproduce the behavior:

Clone repo https://github.com/stolinski/sk-gquery-reporduction npm install Open in vscode, look at any .svelte file.

Expected behavior

Plugin would work and no errors on loading.

Screenshots If applicable, add screenshots to help explain your problem. Screen Shot 2021-11-03 at 10 44 03 AM

System (please complete the following information):

  • OS: MacOS
  • IDE: VSCode
  • Plugin/Package:“Svelte for VSCode”

Additional context

There doesn’t seem to be any issue functionally but the error does clog our error log and causes issues trying to find TS errors.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jasonlyu123commented, Nov 4, 2021

As mentioned in the discord. This is a problem with the node.js version vscode bundled. It’s 14.16.0 in vscode 1.61.2. Using the svelte.language-server.runtime config should make the error goes away. It works on my machine.

From node.js API docs nodejs 14.16.0 uses cjs-module-lexer 1.0.0. While 14.17.0 uses cjs-module-lexer 1.1.1. And from the change log. The babel issue seems to be fixed in 1.1.1. So this issue should be resolved the next time vscode bumps the node.js version. (probably depends on the electron version they’re using though)

0reactions
jasonlyu123commented, Apr 21, 2022

I am going to close this since I think this is fixed and I can’t reproduce this anymore. Feel feel to reopen if you can still reproduce this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Named export 'Types' not found. The requested module ...
import Types from 'mongoose' works because we are importing the package's default export (this is why the name we use does not matter)....
Read more >
VS Code API | Visual Studio Code Extension API
VS Code API. VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This...
Read more >
Debugging ES Modules in Node.js and Mocha Using VS Code
For example, a CommonJS module declares what to export by making assignments to its module object: // name.js var name = 'foo'; module.exports...
Read more >
Troubleshooting Common Issues | Salesforce for VSCode
If you don't see any SFDX commands in the command palette, make sure that you're working on a Salesforce DX project and that...
Read more >
ApexSQL Database Power Tools for VS Code for a first-time ...
Make sure to fill out all the required information and know that the connection will fail if SSH is not available: Host: The...
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