Open JounQin opened 2 years ago
If you're importing a type, I think you'll need to specify for esbuild to understand:
- import { Rule, Scope } from 'eslint'; // `Rule` and `Scope` are both ts namespace
+ import type { Rule, Scope } from 'eslint'; // `Rule` and `Scope` are both ts namespace
I know how to workaround this, I just forgot that could be an esbuild issue and the codes come from 3rd-party repository. I'll raise a new issue there instead. (Stupid me. 😅)
I haven't tested yet but I think this is unblocked as of:
I tested it out just now. Some observations:
package.json#type:module
), the import statements are preserved, so it fails on the first namespace import because it's preserved for ESM:
import { Rule, Scope } from 'eslint'
eg.
SyntaxError: The requested module './some-file' does not provide an export named 'someNamespace'
Tree-shaking must be enabled to get this benefit
Or can we add a flag to enable it manually?
Bug description
Reproduction
Environment
Can you contribute a fix?