feat(isValidNodeImport): support stripComments option#236
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #236 +/- ##
==========================================
- Coverage 88.04% 87.34% -0.71%
==========================================
Files 8 8
Lines 1062 1098 +36
Branches 188 200 +12
==========================================
+ Hits 935 959 +24
- Misses 127 139 +12 ☔ View full report in Codecov by Sentry. |
|
BTW any idea of a safer way to strip comments from a code so we can enable it by default in hasESMSyntax and hasCJSSyntax ? |
|
Thanks for the PR. I think the addition of this option is good for me but I probably won't enable it in any higher layers like Nitro because it can cause other regressions unless there are more examples like
#219 (in next major version) |
stripCommentsFromCode
stripCommentsFromCodestripComments option
🔗 Linked issue
huang-julien/nitro-applicationinsights#58
nitrojs/nitro#2308
❓ Type of change
📚 Description
hi 👋 this PR adds a
stripCommentsFromCodeoption forisValidNodeImport.I think the
stripCommentsoption fromdetectSyntaxwas made to avoid breaking anything in the ecosystem.The issue lies in the non-legacy externals plugin in nitro which tries to inline
applicationinsightsimport when it shouldn't due to applicationinsights having cjs syntax and esm syntax within its comments.The goal of the PR is to open another PR in nitro to add a
stripCommentsFromCodeoption for theexternalrollup plugin.📝 Checklist