Can I rewrite the import specifier with TypeScript?
As stated in the TypeScript FAQs, it is explicitly out of scope for TypeScript to modify module specifiers as they appear in emitted JavaScript. If you write import x from "some/path"
, the output specifier will always be "some/path"
regardless of any TypeScript compiler settings.
Solutions
This is a work in progress.
- using
vm
module to provide a syntheticrequire
implementation