You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because Node.js supports both require() and import() in CommonJS files, it would be helpful to be able to retain import() calls instead of translating them into require(). Here's a very simple example of what I'm trying to do:
This issue has been resolved via #4647 as part of rollup@3.0.0-8. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.0.0-8 or npm install rollup@beta. It will likely become part of a regular release later.
Feature Use Case
Because Node.js supports both
require()
andimport()
in CommonJS files, it would be helpful to be able to retainimport()
calls instead of translating them intorequire()
. Here's a very simple example of what I'm trying to do:https://rollupjs.org/repl/?version=2.71.1&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMGZ1bmN0aW9uJTIwZG9JbXBvcnQoc3BlY2lmaWVyKSUyMCU3QiU1Q24lNUN0cmV0dXJuJTIwaW1wb3J0KHNwZWNpZmllciklM0IlNUNuJTdEJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyY2pzJTIyJTJDJTIybmFtZSUyMiUzQSUyMm15QnVuZGxlJTIyJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=
Feature Proposal
Add a
preserveDynamicImports
option that can be set to:"all"
- never rewriteimport()
regardless of the value passed in"variable"
- only preserveimport()
if it's used with a variable, otherwise overwrite as usual"static"
- only preserveimport()
when passed a constantThe text was updated successfully, but these errors were encountered: