Closed bluwy closed 10 months ago
@bluwy I agree it would be nice to add this trailing whitespace / comment adjustment to the output. This isn't so much a bug though since arbitrary dynamic import expressions just are considered as arbitrary code expressions and the handling of whitespace and comments is thus somewhat of an implementation detail. I will leave this open to track any improvement here as a feature.
When parsing a dynamic import with backticks, the
s
ande
result can be used to get the raw string. However thee
result seems to always be one index less of the closing parenthesis/comma, instead of the last backtick.Reproduction
Stackblitz
Run
node index.js
in the terminal to log the first parsed importExpected result
The log should be
"`bla.js`"
Actual result
It gives
"`bla.js`\n /* bar */\n"
(trailing comments aren't stripped)