Open matthewp opened 7 years ago
Couldn't we detect this fairly easily via the ast?
I don't know about easily, but it would be possible. Not sure it's worth the time though.
I think it's very easy to see if there is a global var statement. Transpile already does a bunch of stuff like this (like checking for require function calls). Id imagine it would be just the same.
The reason the global -> AMD format is so gross is because some globals define themselves with a var; like so:
This means that we have to run
eval()
on the source, rather than just inlining it in a module. Other globals that set themselves on thewindow
object will work fine.This will be a breaking change, so next major release.