Category : umd

I have two rollup libs, of which names are the same, "CesiumGIS". In index.html I included two libs like this. <script src="./DrawingTools.js"></script> <script src="./measureTools.js"></script> The first lib exports CesiumGIS.drawingTool and second CesiumGIS.measureTool. But CesiumGIS.drawingTool becomes undefined by including the second lib. How to solve it? Thank you. Source: Ask Javascript..

Read more

I’m trying to load barba.js (umd) with require.js to my project. The import works fine but if I’m calling the barba-init function I’m getting an error: Uncaught TypeError: barba.init is not a function Thats my main js-file: requirejs.config({ "paths": { "jquery": "//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min", "bootstrap": "../node_modules/bootstrap/dist/js/bootstrap.bundle.min", "barba": "../node_modules/@barba/core/dist/barba.umd" } }); requirejs(["jquery", "bootstrap", "barba"], function ($, barba) { ..

Read more

I recently upgraded to Webpack 5 and I’m having some trouble importing UMD modules. In particular, I’m trying to import Leaflet. Leaflet seems to export a UMD module created by rollup.js, which looks like this: (function (global, factory) { typeof exports === ‘object’ && typeof module !== ‘undefined’ ? factory(exports) : typeof define === ‘function’ ..

Read more

I’m trying to include an external Vue component (Pagination) from a compiled UMD file served locally. HelloWorld.vue <template> <div class="hello"> <Pagination :pages="5"></Pagination> </div> </template> <script> import Vue from ‘vue’; import externalComponent from ‘../utils/external-component’; const LibComponents = () => externalComponent(‘http://localhost:5000/lib-vue.umd.js’); const Pagination = LibComponents().then(module => { return module.library.Pagination; }); export default { name: ‘HelloWorld’, components: { ..

Read more

I have a file named a.ts which looks like this: function abc(){ alert("abc()") } export {abc} And a second file named b.ts which looks like this: import * as a from "./a" a.abc(); I compiled it with tsconfig.json of: { "compilerOptions": { "module": "umd", "sourceMap": false, "moduleResolution": "node", "declaration": false, "outDir": "./outDir" }, "files": [ ..

Read more

I’m trying to import an umd.js file into an angular project. The module (library) is declared as follows: (function (global, factory) { typeof exports === ‘object’ && typeof module !== ‘undefined’ ? factory(exports, require(‘@angular/core’), require(‘@angular/common’)) : typeof define === ‘function’ && define.amd ? define(‘MyCustomModule’, [‘exports’, ‘@angular/core’, ‘@angular/common’], factory) : (global = global || self, factory(global[‘MyCustomModule’] ..

Read more