requirejs

Unable to use requireJS and Node's Require in the same TypeScript project

£可爱£侵袭症+ 提交于 2019-12-30 12:16:18
问题 I have a typescript project targeted at both Node and the browser. I'm using Node's require() in some scripts and requireJS's require() in others. My project directory looks like this: myProject \-- a.ts \-- b.ts \-- node.d.ts \-- require.d.ts where a.ts contains: /// <reference path="./node.d.ts" /> var cp = require('child-process'); var a = 'hello world' export = a and b.ts contains: /// <reference path="./require.d.ts" /> require('hello',function(x){console.log('world')}); var b = 'hello

Unable to use requireJS and Node's Require in the same TypeScript project

╄→尐↘猪︶ㄣ 提交于 2019-12-30 12:16:10
问题 I have a typescript project targeted at both Node and the browser. I'm using Node's require() in some scripts and requireJS's require() in others. My project directory looks like this: myProject \-- a.ts \-- b.ts \-- node.d.ts \-- require.d.ts where a.ts contains: /// <reference path="./node.d.ts" /> var cp = require('child-process'); var a = 'hello world' export = a and b.ts contains: /// <reference path="./require.d.ts" /> require('hello',function(x){console.log('world')}); var b = 'hello

RequireJS: loading different files according environment

狂风中的少年 提交于 2019-12-30 06:54:47
问题 Is there any functionality to load different files according on current project environment (development or production for example)? I mean something, that helps me transparently loading minified or full files. I read about multiversion loading, but multiversioning means that I need to specify version of file. For example I have module.js file with my module. In this file I need to load jQuery: require(['jquery]); But I have minified and full version of jQuery and I want to load different

Simple requireJS with angularJS - angular is not defined

爷,独闯天下 提交于 2019-12-30 06:54:11
问题 I am new to requireJS, and I wanted to get a simple starter 'hello worldish' project up and running. I'm missing something though, because I get angular is not defined as a JS error when the GreetCtrl tries to load. index.html: <!DOCTYPE html> <html ng-app="ReqApp" ng-controller="GreetCtrl"> <body> <h1>{{greeting}}!</h1> <script src="assets/require/require.js" data-main="assets/require/main"></script> </body> </html> main.js: require.config({ // alias libraries paths paths: { 'domReady':

How to add Tether in Aurelia-CLI to use with Bootstrap 4

♀尐吖头ヾ 提交于 2019-12-30 06:38:13
问题 I am trying to add Bootstrap 4 to Aurelia . I can only get the CSS to work but the bootstrap.js requires Tether and I can't get it included, since I keep getting this error in the console: Bootstrap tooltips require Tether I tried something along this "jquery", "Tether", { "name": "tether", "path": "../node_modules/tether/dist", "main": "js/tether.min", "exports": "Tether", "resources": [ "css/tether.css" ] }, { "name": "bootstrap", "path": "../node_modules/bootstrap/dist", "main": "js

Requirejs' order does not work with priority config and CDN dependencies

不羁岁月 提交于 2019-12-30 05:29:16
问题 The following main.js code do not respect the order of priorities (sometimes underscore.js is not loaded when backbone.js needs it): require({ baseUrl:'/scripts', priority:[ "http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js", "http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.6/underscore-min.js", "http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js" ] },["src/app"], function (app) { app

Using RequireJS with TypeScript and AngularJS

梦想与她 提交于 2019-12-30 02:01:11
问题 I'm about to rip my brains out trying to define an Angular module in TypeScript while using RequireJS. Have looked all over for a solution while spending days trying to figure it all out to no avail. Please help, I'm so confused! I'm not using Visual Studio, but rather WebStorm. This shouldn't really matter however. I'm using TS 9.1, AngularJS 1.0.7, RequireJS 2.1.8. I've also tried using DefinitelyTyped's angular.d.td, but it's not helping. Does anyone have a simple example of a TS angular

router.js Function not executed

被刻印的时光 ゝ 提交于 2019-12-29 09:36:47
问题 // Filename: router.js console.log('TEST ROUTE'); define([ 'jquery', 'underscore', 'backbone', 'views/jobs/list' ], function($, _, Backbone, JobListView){ var AppRouter = Backbone.Router.extend({ routes: { // Define some URL routes '/dalo/jobs': 'showJobs', // Default '*actions': 'defaultAction' } }); var initialize = function(){ var app_router = new AppRouter; app_router.on('route:showJobs', function(){ // Call render on the module we loaded in via the dependency array // 'views/jobs/list'

Issue loading knockout components view model using requireJS

雨燕双飞 提交于 2019-12-29 07:12:15
问题 I am working with the new components functionality of knockout 3.2 and trying to load the components using requireJS. However, I am having a weird issue. Basically, when I hardcode the view model in the register function everything works fine. When I try to load the exact same view model using requireJS, it's not working correctly. Here's a sample of the html to load the component: <div data-bind="component: { name: 'test'}"></div> Here's the html in the template that this component will load

Debugging JavaScript in IE

邮差的信 提交于 2019-12-29 05:43:26
问题 I am trying to debug my JavaScript in IE but I have no idea where to start. Can anybody help me? I think it's only a small error, but the developer tools are a bit useless. An unexpected identifier error comes up when you go to http://songtagapp.com/. I think it's something to do with the tpl! plugin I am using for RequireJS, but that's all I can tell. 回答1: Several options: Open the IE developer tools (by hitting F12 while in the browser), and use the provided JavaScript debugger. To get to