requirejs

Unable to load jQuery plugins when using requirejs & r.js optimizer

可紊 提交于 2019-12-10 04:19:45
问题 I'm having a bit of trouble with my the requirejs optimizer. After I run the optimizer, I get a few error messages in my build/compiled file. When running my web application without the optimize step I do not have any errors. This is my client.js file (contains config) (coffeescript) requirejs.config baseUrl: '/source/' paths: text: 'lib/text' io: 'lib/socket.io' underscore: 'lib/underscore' backbone: 'lib/backbone' jquery: 'lib/jquery' # almond: 'lib/almond' bootstrap: 'lib/bootstrap'

override setTimeout in require.js

倾然丶 夕夏残阳落幕 提交于 2019-12-10 04:13:47
问题 we are using require.js in our project and we need to override the setTimeout in line 705 , this is the code which we need to ignore/omit somehow this setTimeout at all(I mean run over it) ,the problem that if I change it in the open source code explicit when I change version the code will be lost,How should I override this setTimout from outside only for the require.js file and keep it as long as I use this lib, is it possible to do it in elegant way in JS globally ? https://github.com

Webpack url and file loaders don't working on Angular 2 required component styles

ぐ巨炮叔叔 提交于 2019-12-10 04:06:22
问题 I’m building an app with angular 2, sass and webpack and I’m having troubles with url on sass files that are required inside each component (using require); it doesn’t take those files and copy it to assets folder and don’t modify the url to the builded css styles. It work's correctly when I use import and with the assets inside html component's. loaders: ...{ test: /\.html$/, loader: 'html' }, { test: /\.(png|jpe?g|gif)$/, loader: 'file?name=assets/[name].[hash].[ext]' }, { test: /\.scss/,

Dojo require, connect to error when module failed loading

自作多情 提交于 2019-12-10 03:36:41
问题 When I try to load nonexistent module, it fail with 404 error (of course). I want to handle this error but don't know how to connect to "error" event. According to Dojo doc, I should be able to do that using its micro event api. This code does not work. var handle = require.on('error', function( error ) { alert('Finally error') }); require(['nonexistent/module'], function ( m ) { alert('Module was loaded correctly') }); Dojo version is 1.7.1, browser latest Chrome. 回答1: The documentation on

Lodash - '_' refers to a UMD global and lodash.js is not a module errors

怎甘沉沦 提交于 2019-12-10 03:34:41
问题 If I do nothing and add the type definition it works for jquery but lodash gets a '_' referes to a UMD global, but the current file is a module. Consider adding an import instead. If I try to import lodash with any combination of import call, I get lodash.js is not a module I tried to get help by asking a question here and it was closed because there was another answer for Angular (Angular 2). I really need a real answer so I'm re-posting with my own solutions, hoping someone will eventually

Requirejs configuration in different file

雨燕双飞 提交于 2019-12-10 02:51:58
问题 I am using requirejs. My main.js content is like following. requirejs.config({ async: true, parseOnLoad: true, packages: [], paths: { jquery: 'https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min' } }); require(["login"], function (loginService) { loginService.login('validUser'); }); Now, my config elements are little. But later, I will add packages, paths and others, so the require.config lines will increase. I wanna separate require.config as a different file and use it? If jquery

Backbone Routes Not Being Called

自古美人都是妖i 提交于 2019-12-10 02:43:17
问题 I have a strange issue I haven't been able to figure out as of yet. It's very simple which is probably why I'm having trouble with it :) First, here's the routing table... routes: { '': 'root', //called 'report': 'report', // called 'report/add': 'reportAdd', // not called 'report/print': 'reportPrint', // not called 'report/settings': 'reportSettings', // not called }, You'll see I marked which ones are working and which ones aren't. The problem boils down to all subroutes (i.e report/add )

Bootstrap 4 error “Bootstrap dropdown require Popper.js”, with Aurelia CLI and Require.js

时光怂恿深爱的人放手 提交于 2019-12-10 01:09:59
问题 I'm having trouble configuring Bootstrap 4 beta in an Aurelia CLI app (v0.31.1) with requirejs and using TypeScript. After having tried several config variations I keep on getting the following console error: Uncaught Error: Bootstrap dropdown require Popper.js Here are the steps to reproduce. First, install the packages: $ npm install --save jquery bootstrap@4.0.0-beta popper.js Next, I've configured aurelia.json : "jquery", { "name": "popper.js", "path": "../node_modules/popper.js/dist/umd"

Define is not defined (ESLint)

♀尐吖头ヾ 提交于 2019-12-10 00:53:25
问题 I keep getting an ESLint error 'define' is not defined. (no-undef) . I believe, I could just define define globally, but shouldn't this be supported natively? A code example using define: define([], function () { // Error here! 'use strict'; .... This is my eslintrc.json: { "env": { "shared-node-browser": true, "commonjs": true }, "plugins": ["requirejs"], "extends": ["eslint:recommended"], "rules": { "indent": [ "error", "tab" ], "linebreak-style": [ "error", "windows" ], "quotes": [ "error"

RequireJS: Conditionally Load Polyfill Using Modernizr

久未见 提交于 2019-12-10 00:16:26
问题 How do you wrap a polyfill script as an AMD module and conditionally load it using Modernizr and RequireJS? (Figured it out while I was drafting my question - posting answer for anyone else trying to do the same thing.) 回答1: The polyfill I needed to load was jquery-placeholder for browsers that don't support input placeholders. It does not provide AMD support out of the box. First I wrapped it as an AMD module like this: define(['jquery'], function ($) { (function(window, document, $) { ...