i was experimenting again with the new ESM loader and found a little bug while async import.
can-component uses
var DOCUMENT = require('can-globals/document/document');
This should get avoided totally! because it leads to can-globals don't works as expected as document/document returns a function that returns global.document the following code posted befor inside can-component for example and all other modules that require can-global/document/document or any of ther other wrappers directly will not work
import makeDocument from 'can-vdom/make-document/make-document';
import globals from 'can-globals';
globals.setKeyValue('document',makeDocument());
import DOCUMENT from 'can-globals/document/document';
globals.getKeyValue('document') //=> retuns document
//=> DOCUMENT === 'undefined'
can-component.js
var globals = require('can-globals');
var DOCUMENT = globals.getKeyValue('document')
because the wrapper returns the befor mentoined function so i would say always import globals and use globals.getKeyValue('document') same for location
Summary
can-globals/document/document gets importet in some can-* components and returns a function that returns getKeyValue('global').document this should not be the case it should return getKeyValue('document') same for location
i was experimenting again with the new ESM loader and found a little bug while async import.
can-component uses
This should get avoided totally! because it leads to can-globals don't works as expected as document/document returns a function that returns global.document the following code posted befor inside can-component for example and all other modules that require can-global/document/document or any of ther other wrappers directly will not work
can-component.js
because the wrapper returns the befor mentoined function so i would say always import globals and use globals.getKeyValue('document') same for location
Summary
can-globals/document/document gets importet in some can-* components and returns a function that returns getKeyValue('global').document this should not be the case it should return getKeyValue('document') same for location