Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
/ resolve-imports Public archive

A Rollup plugin that resolves imports to their entry-points in emitted bundles.

License

Notifications You must be signed in to change notification settings

tszip/resolve-imports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resolve Imports

This is a Rollup plugin that resolves import specifiers in input files:

import packageSubdir from 'my-package/something'
import packageDefault from 'my-package'
import relativeImport from './relative'

To fully ESM-compatible specifiers including file extensions, deferring to package.json exports field for imported modules:

// package.json exports: ./* -> ./*/index.js
import packageSubdir from 'my-package/something/index.js'
// package entry is OK
import packageDefault from 'my-package'
// resolve relative import
import relativeImport from './relative.js'

This plugin was developed to turn TypeScript's module: esnext into valid ESM. By default, TS emits relative imports like import stuff from './myModule', which must be resolved at build-time in order for it to execute in an ESM context.

Further reading

Issues

Comments

About

A Rollup plugin that resolves imports to their entry-points in emitted bundles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published