require is not defined

You’re trying to use a CommonJS module from within your browser. This will not work. How are you using them? When you write import … from … in ES6 Babel will transpile these calls to a module definition called CommonJS and since CommonJS isn’t around in the browser you’ll get an undefined error from require(). … Read more

using requirejs to load npm packages

Require.JS is for loading AMD modules. Node.js modules are either ECMAScript modules (which use import and export) or CommonJS modules (which use require and module.exports). Even though both AMD and CommonJS modules use a function named require they are, in general, not compatible. (It is possible to write a module so that it meets the … Read more

How to require jquery via AMD in TypeScript

FOR TYPESCRIPT 1.7+ It looks like standard is changing again, where the below 0.9+ method still works, but with ES6 coming the following module loading could be used. (reference: https://github.com/TypeStrong/atom-typescript/issues/237#issuecomment-90372105) import * as $ from “jquery”; and even partial ones import {extend} from “jquery”; (this still require the jquery.d.ts, if tsd is installed – tsd … Read more

Ember.js and RequireJS

EDIT (2012-01-30): I pushed a more complete example in a repo on bitbucket. I have successfully used RequireJS to load Ember.js as well as the datetime addon (github). The Ember namespace itself stays global, but all of my application’s data, including my instance of Ember.Application, is kept within modules through RequireJS. I’m also loading the … Read more