yysun / apprun

AppRun is a JavaScript library for developing high-performance and reliable web applications using the elm inspired architecture, events and components.

Home Page:https://apprun.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

global values created for ESM version

tvardy opened this issue · comments

apprun/src/apprun.ts

Lines 61 to 66 in f16a53d

if (typeof window === 'object') {
window['Component'] = Component;
window['React'] = app;
window['on'] = on;
window['customElement'] = customElement;
}

becomes

apprun/esm/apprun.js

Lines 40 to 45 in f16a53d

if (typeof window === 'object') {
window['Component'] = Component;
window['React'] = app;
window['on'] = on;
window['customElement'] = customElement;
}

I noticed that part accidentally while checking other things... I got surprised that even though I haven't imported the Component in a separate component file, the script was able to find a reference and interpret ... extends Component { without throwing an error.

I guest the ESM version shouldn't expose global variables... this should only show up in the dist

I agree.