modularify
global is eval
so this tool will transform window assignment to commonjs way
from
{ var Button = 1; document; window'Button' = Button;}window
to
var document = ;var window = ; var win = window;var Button = 1;document;exports'Button' = Button;
Options
Could work with babel and could pass babel options;
; // babel 6 issue const opts = plugins: modularifyremoveRootCallExpression modularifyremoveCallExpression rules: 'componentHandler' modularifyassignGlobalsWithRequire globals: window: 'global' document: 'global/document' modularifyexportsReplace exports: window: 'exports' modularify;