Breaking change in LWC import and export statements
Why is this an issue?
This rule applies to JavaScript files inside Lightning Web Component bundles.
From LWC version 62.0 and later, Salesforce prevents the use of bare imports, bare exports, and wildcard re-exports of the lwc package.
Examples
Example of incorrect code:
// Don't do this
import 'lwc';
import {} from 'lwc';
export * as lwc from 'lwc';
export {} from 'lwc';
Example of correct code:
import { LightningElement } from 'lwc';
export { LightningElement } from 'lwc';
How can I fix violations?
This rule supports autofix for bare import statements: the offending import is removed automatically. Bare exports are not autofixed and must be corrected manually.
Replace bare imports: Convert to named imports specifying what you need.
Replace bare exports: Use named exports for specific items.
Don't wildcard-re-export
lwc: Named re-exports such asexport { LightningElement } from 'lwc';are allowed; wildcard (export *) and empty (export {}) re-exports are not.
Resources
