4 ms·
Nowadays, I either include javascript as a module or as a module dependency. I am still not sure if these will work with the given code: As a module: <scr
by TicklishTiger 7y ago
Nowadays, I either include javascript as a module or as a module dependency. I am still not sure if these will work with the given code:
As a module:
<script type="module" src="Chart.js"></script>
As a module dependency:
import * as chart from 'Chart.js';
- ng12 7y agoYes, this is the point of that code. It's boilerplate to ensure the module loads in different environments.
- spankalee 7y agoUMD does _not_ support standard JS module imports. The UMD code won't detect `exports` or `define` and will write to globals instead of producing any exports.
- ng12 7y agoI'm not sure what you mean. Obviously UMD cannot support native es6 modules since they're syntactical invalid for non-es6 applications.
- spankalee 7y agoThe GP wants to import into JS modules, and you said: > Yes, this is the point of that code. It's boilerplate to ensure the module loads in different environments. but the UDM header does not allow the module to load in JS modules. So I'm not quite sure what you meant actually. The header does nothing for standard modules.