Questions tagged [umd]

Universal Module Definition (UMD) is an API for JavaScript modules that are capable of working in browsers, on the server, or elsewhere.

Universal Module Definition (UMD) is an API for JavaScript modules that are capable of working in browsers, on the server, or elsewhere.

The UMD pattern typically attempts to offer compatibility with the most popular script loaders of the day (RequireJS, CommonJS, and others). In many cases it uses AMD as a base, with special-casing added to handle CommonJS compatibility.

See the GitHub repo for more information.

198 questions
0
votes
1 answer

Webpack - combining two anonymous modules into one combined.js file

I am trying to combine two require amd modules into one combined.js javascript file using Webpack. module1.js //module1.js - objectTest1 (function (root, factory) { 'use strict'; //Universal Module Definition if (typeof define ===…
xtrm
  • 966
  • 9
  • 22
0
votes
0 answers

mousemove event cause network errors

I have angular 2 project where i am using jquery code : $('#someId').mousemove(someFunction); To isolate the problem, 'someFunction' is an empty function; When i move the cursor on the #someId element, i got those errors: Browser Errors I Tried to…
John Libes
  • 363
  • 3
  • 11
0
votes
0 answers

js - Closure Compiler and UMD

I have some code with a UMD pattern like this: (function (root, factory) { if (typeof define === 'function' && define.amd) { define([], factory); } else if (typeof module === 'object' && module.exports) { …
user7353781
  • 155
  • 2
  • 10
0
votes
1 answer

Typescript import and Webpack

I am trying to use the hellosign-embedded module from my TypeScript application, which is then packaged using Webpack and run as part of a web page. I've also imported the @types typings. The problem is that if I use: import * as HelloSign from…
Flavien
  • 7,497
  • 10
  • 45
  • 52
0
votes
1 answer

Webpack output UMD library with CamelCase and spinal-case name

How do I configure Webpack to create UMD bundle, so that package name for AMD and CommonJS will be named in lowercase (spinal-case), and for global context will have CamelCase name? For example I expect my bundle to start with (function…
Alexander Shutau
  • 2,660
  • 22
  • 32
0
votes
1 answer

prevent react from being bundled in my module so react can't exist twice

I am writing a npm package that depend on : "peerDependencies": { "react": "15.4.1", }, "dependencies": { "classnames": "2.2.5", "react-onclickoutside": "5.8.3", "styled-components": "1.1.2" } I have added them as peer dependencies. I have…
Dimitri Kopriwa
  • 13,139
  • 27
  • 98
  • 204
0
votes
1 answer

Error Referencing ng2-bootstrap.umd.min.js in asp.net core

I am trying to use ng2-bootstrap with angular2 and asp.net core. I reference "ng2-bootstrap": "^1.0.24" in package.json When I try reference the node_models/ng2-bootstrap/bundles/ng2-bootstrap.umd.min.js I get the following error Uncaught Error:…
Martin Sher
  • 25
  • 1
  • 4
0
votes
1 answer

Webpack: How to hide export functions/variables under one global variable?

I am changing the way a TypeScript library is building, from gulp concat + typescript compiler to Webpack. The library now can be used with require/import key words. However, I have to leave the ability to use a library in a classic way, including…
Dmitry Kurmanov
  • 765
  • 2
  • 12
  • 19
0
votes
1 answer

Creating React component for distribution results in much larger build than expected

I've loosely followed this link to create my react components for distribution. My webpack production build is below. However my build comes out much larger than I would expect it to considering that the individual file sizes combined are somewhere…
Terence Chow
  • 10,755
  • 24
  • 78
  • 141
0
votes
0 answers

What's the best way to wrap an ES6 library?

What's the best way to setup an ES6 library so that it's modular and transpiles into one ES5 UMD file? I looked at the way async.js and lodash do it, but it's hard to understand what's going on. For example, index.js: import doSomething from…
John Derring
  • 515
  • 1
  • 4
  • 15
0
votes
1 answer

Correct use of UMD - Ramjet JS

Complete Code: Fiddle I'm trying to learn UMD, I took a day trying to run this Ramjet JS. I don't understand this error that occurs here: (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ?…
York Xtrem
  • 58
  • 1
  • 10
0
votes
1 answer

Webpack UMD issue with jQuery

My library is built with webpack. The libraryTarget is UMD. The problem is with my dependencies. For example I am using jQuery. My webpack config looks like: // Only relevant config is shown below module.exports = { externals: { …
tiktak
  • 57
  • 10
0
votes
1 answer

Controlling "exposed global variable" of UMD javascript module

I am creating a little Javascript frontend framework. I decided to optimize it for HTTP 2 -> no bundling. I have asynchronous dependency loader, that on-demand (in browser) loads all needed resources for the given page. But there's a little problem.…
Matúš Čongrády
  • 1,340
  • 3
  • 17
  • 29
0
votes
1 answer

UMD: is assigning to module.exports redundant?

I see JS libraries using these two different implementations. Only difference is the CommonJS line. Are they functionally the same? Is assigning the value to module.exports not required? /* 1: Assignment to module.exports */ (function(factory) { …
Rob Flaherty
  • 1,055
  • 6
  • 16
0
votes
1 answer

Test coverage of Browserify standalone (UMD) modules

I use the browserify standalone option in the following gulp tasks to generate an UMD module: gulp.task("bundle-source", function () { var b = browserify({ standalone : 'inversify', entries: __dirname + "/build/source/inversify.js", …
Remo H. Jansen
  • 23,172
  • 11
  • 70
  • 93
1 2 3
13
14