VSCode Error - SyntaxError: Named export 'isIdentifier' not found.
See original GitHub issueDescribe 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.
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:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 usescjs-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)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.