[no-commonjs] add allowConditionalRequire option - #1439
Conversation
a7c63d9 to
654dc10
Compare
ljharb
left a comment
There was a problem hiding this comment.
I think that the option may need to be added first, so that those who are relying on these warnings have an existing solution to enable them.
|
I have no idea how to add the option without making these changes... Do you mind if I just add it in the same PR? |
I highly doubt if anyone is relying on these warnings. The only breaking change is that |
|
@Pessimistress adding the option in this PR sounds fine to me. |
| } | ||
|
|
||
| function validateScope(scope) { | ||
| if (scope.variableScope.type === 'module') return true |
There was a problem hiding this comment.
| if (scope.variableScope.type === 'module') return true |
now that the other change is done :-)
945ee6d to
a60e5c6
Compare
Fixes #1437
Currently:
if (typeof window !== "undefined") require("x")is reported by defaultif (typeof window !== "undefined") { require("x") }is never reported (scope)typeof window !== "undefined" && require("x")is never reported (conditional require)After this PR, all cases will be treated the same (as conditional requires). A follow up PR will add an option for users to configure whether conditional requires should be reported.