amd

Webpack: expressing module dependency

主宰稳场 提交于 2019-12-20 08:59:42
问题 I'm trying to require the bootstrap-webpack module in my webpacked application. It appears to need jQuery, since the bundled javascript then throws the following: Uncaught ReferenceError: jQuery is not defined How do I go about specifying to webpack that jQuery is a dependency for the bootstrap-webpack module, to fix this issue? It feels like it should be trivial, but I've been struggling to figure it out. I've tried adding: "jquery": "latest" to the dependecies in the bootstrap-webpack's

Why do concatenated RequireJS AMD modules need a loader?

我与影子孤独终老i 提交于 2019-12-20 08:28:19
问题 We love RequireJS and AMD during development, where we can edit a module, hit reload in our browser, and immediately see the result. But when it comes time to concatenate our modules into a single file for production deployment, there apparently has to be an AMD loader still present, whether that loader is RequireJS itself or its smaller partner “almond” as explained here: http://requirejs.org/docs/faq-optimization.html#wrap My confusion is: why is a loader necessary at all? Unless you have

TypeScript won't resolve module when import is used

天大地大妈咪最大 提交于 2019-12-19 10:47:41
问题 // Modules/MyModule.ts -------------------------------- import fs = require("fs"); module Hello { export function World(): string { return "Hello World"; } } // Main/App.ts ---------------------------------------- console.log(Hello.World()); // Cannot find name 'Hello' For some reason this produces the error specified above. The weird thing is if I uncomment the import statement I don't get this error anymore. (it's not used anyway) Both produce the same error: tsc Main/App.ts --module

TypeScript compilation of RequireJS module generates line Object.defineProperty(exports, “__esModule”, { value: true }); How to get rid of it?

坚强是说给别人听的谎言 提交于 2019-12-19 06:18:07
问题 This is how my tsconfig.json file looks: { "compileOnSave": true, "compilerOptions": { "module": "amd", "noImplicitAny": false, "removeComments": false, "preserveConstEnums": true, "strictNullChecks": true, "sourceMap": false } } I have a typescript file named a.ts which is an AMD module (I'm using requirejs), which looks like: export function a() { var a = { b: 5 }; return a; } The compiled Javascript files looks like: define(["require", "exports"], function (require, exports) { "use strict"

requirejs blueimp fileuploader only loads min.js files and none other

柔情痞子 提交于 2019-12-19 04:44:29
问题 so I'm a noobie to requirejs and backbone, but I'm trying to load in all the dependencies for blueimp file uploader on my local machine and not load any external scripts. here is my config.js file: // Set the require.js configuration for your application. require.config({ // Initialize the application with the main application file. deps: ["main"], paths: { // JavaScript folders. libs: "../assets/js/libs", plugins: "../assets/js/plugins", vendor: "../assets/vendor", api : "../assets/js/libs

Dojo AMD: Can't call a function inside a require

瘦欲@ 提交于 2019-12-18 13:01:18
问题 I am really a newbie to dojo but as i started developing a new application with dojo version 1.7.2 i also wanted to use the new AMD syntax for functions. Unfortunately i don't seem to get it. :-( What annoys me most is that i can't simply call any function which is inside of a "require"-block. For example i have a page which on opening creates a dynamic table with several widgets in each row. Then i have a button which adds one empty row each time pressed. Without AMD syntax it would be easy:

Dojo AMD: Can't call a function inside a require

一笑奈何 提交于 2019-12-18 13:01:05
问题 I am really a newbie to dojo but as i started developing a new application with dojo version 1.7.2 i also wanted to use the new AMD syntax for functions. Unfortunately i don't seem to get it. :-( What annoys me most is that i can't simply call any function which is inside of a "require"-block. For example i have a page which on opening creates a dynamic table with several widgets in each row. Then i have a button which adds one empty row each time pressed. Without AMD syntax it would be easy:

TypeScript: compiling removes unreferenced imports

狂风中的少年 提交于 2019-12-18 11:41:19
问题 In our project we're using RequireJS as our module loader. Some of our modules will influence global libraries, and hence won't be directly used within the module they are referenced in. Example: define(['definitely/goingto/usethis/','just/referencingthis/forpackaging'], function(useThis) { useThis.likeIPromised(); // the following call can only be made when the second required file is available someGlobalAvailableVariable.someMethod(); }); This works as expected when writing my modules in

How do I document AMD + Backbone project with JSDoc3

情到浓时终转凉″ 提交于 2019-12-18 05:56:29
问题 I have a Backbone boilerplate based project, that I want to document with recent jdoc-toolkit Though I can't get it to generate anything but empty _global class Code sample: /** * This is a root model for DLClass * @module models/DLClass */ define([ 'underscore', 'backbone' ], /** @lends DLClass */ function (_, Backbone) { /** * This is a root model for DLClass * @class DLClass * @constructor * @return Session Object */ var DLModel = Backbone.Model.extend({ /** @lends DLClass.prototype */ /**

jQuery source code uses Require.js, but the final file doesn't?

别来无恙 提交于 2019-12-17 18:42:11
问题 Uncompressed jQuery file: http://code.jquery.com/jquery-2.0.3.js jQuery Source code: https://github.com/jquery/jquery/blob/master/src/core.js What are they doing to make it seem like the final output is not using Require.js under the hood? Require.js examples tells you to insert the entire library into your code to make it work standalone as a single file. Almond.js, a smaller version of Require.js also tell you to insert itself into your code to have a standalone javascript file. When