npm i -g d2n
d2n src/index.ts --project-files='{src,test}/**/*.{tsx,ts,js}' --work-on='src/components/form/**/*.{tsx,ts,js}'
import { migrateToNamedExport } from 'd2n';
migrateToNamedExport({
projectFiles: '{src,test}/**/*.{tsx,ts,js}',
workOn: 'src/components/form/**/*.{tsx,ts,js}',
})
- Import from file with
export default
under different name - Index file with
export { default } from './module';
- Index file with multiple
export { default as method } from './module';
- Import from index file under different name
- Handle mixed imports
import COmponent, { Props } from './component';
- Partial migrate by glob pattern
- Handle jest.mock with default property
- Handle jest.mock without default property
- Handle lazy/dynamic import
- Ignore files which will be required
- Run as CLI
- Publish npm package
- Run "Convert 'require' to 'import'"
- Save previous imports with alias