Description
Bug Report
We unconditionally transform dynamic import (import()
) regardless of the current script target when the module kind is None. This is due to us using the CommonJS
module emit as a fallback for None
, and is causing an issue for VSCode while trying to implement support for TS Server plugins on the web via WebWorker.
I propose that we change the emit behavior for import()
when the module target is None
to preserve import()
. Note that this would constitute a breaking change, but I imagine the number of affected projects (those currently using both --module None
and import()
) would be vanishingly small.
🔎 Search Terms
dynamic import module none node transform emit outFile
⏯ Playground Link
Playground link with relevant code
💻 Code
// @target: es2020
// @module: none
// @outFile: foo.js
const foo = import("foo");
🙁 Actual behavior
Transforms import()
into a call to require()
🙂 Expected behavior
Does not transform import()
.