requirejs

How to disable AMD on 4 files and load them in order with webpack

删除回忆录丶 提交于 2019-12-25 09:01:58
问题 I need to disable AMD on 4 files and load video.js first before loading the other 3 files, because they depend on it. When I tried doing it in webpack.config.js like so: const path = require('path') const webpack = require('webpack') module.exports = { entry: './src/main.js', output: { path: __dirname + '/public', filename: 'bundle.js' }, devServer: { inline: true, contentBase: './src', port: 3333 }, plugins: [ new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production

Set up jsfiddle with requirejs, socketio, backbone

╄→гoц情女王★ 提交于 2019-12-25 07:42:44
问题 I've spent more than half a day trying to set up a requirejs, socket.io, backbonejs fiddle so as to solve another SO question. Here is what I tried. You may checkout my fiddle I tried a couple ways without any luck. I've loaded the scripts in the head like this. <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.js"></script> <script> requirejs.config({ paths: { 'socket.io': ['https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.5.1/socket.io.js'], 'jquery': [

Is it possible to use 'fs' (filesystem) module inside page executed by PhantomJS?

混江龙づ霸主 提交于 2019-12-25 05:36:08
问题 I want to have access to filesystem on a page that is rendering by PhantomJS headless browser. I catch an error when JS code is trying to interact with filesystem var fs = require('fs'); ... ReferenceError: Can't find variable: require Is there some hack/plugin to PhantomJS that allows to do that? P.S. I'm using headless tests runner based on PhantomJS (teaspoon) and I want to store some data from tests on filesystem. 来源: https://stackoverflow.com/questions/30779915/is-it-possible-to-use-fs

Loading jCarousel with RequireJS + jQuery

霸气de小男生 提交于 2019-12-25 04:21:29
问题 I'm trying to load a java plugin called jCarousel with RequireJS. My project structure looks like this: [project root] assets app js app.js vendor jquery-2.1.0.js jquery.jcarousel-core.js require.js I'm using the shim config so I first load RequireJS like so: <script data-main="assets/js/app" src="assets/js/vendor/require.js"></script> Then in app.js, I have this configuration of RequireJS: requirejs.config({ "baseUrl": "assets/js/vendor", "paths": { "app": "../../app" }, "shim": { "jquery

Loading jCarousel with RequireJS + jQuery

佐手、 提交于 2019-12-25 04:20:08
问题 I'm trying to load a java plugin called jCarousel with RequireJS. My project structure looks like this: [project root] assets app js app.js vendor jquery-2.1.0.js jquery.jcarousel-core.js require.js I'm using the shim config so I first load RequireJS like so: <script data-main="assets/js/app" src="assets/js/vendor/require.js"></script> Then in app.js, I have this configuration of RequireJS: requirejs.config({ "baseUrl": "assets/js/vendor", "paths": { "app": "../../app" }, "shim": { "jquery

Backbone + RequireJS: HTML files loaded with RequireJS are interpreted as JS files

主宰稳场 提交于 2019-12-25 03:47:11
问题 I would like to rollout with Backbone.js + Require.js. I can load modules just fine. But when I try and load my .html files using the text! plugin (text.js), I get these errors: Resource interpreted as Script but transferred with MIME type text/html: "https://host.net/templates/login.html". require.js:1843 Uncaught SyntaxError: Unexpected token < login.html:1 Uncaught TypeError: Cannot call method 'replace' of undefined underscore.js:1130 Here's the specs of what I'm working with: Browser :

Object scope in javascript (requirejs) [duplicate]

送分小仙女□ 提交于 2019-12-25 02:57:13
问题 This question already has answers here : How to access the correct `this` inside a callback? (10 answers) How does 'this' work in JavaScript? (4 answers) Closed 5 years ago . I'm using requireJS with googlemaps. I'm using plugin to load google maps: https://gist.github.com/taktran/5389668 (google maps api should be loaded with jQuery promise) I have problem with "this" scope. Here is my code: //funcs.js file define('myFuncs', ['jquery', 'googleMaps'], function ($, googleMaps) { var myFuncs =

Why is my RequireJS ignoring the code in my optimized main.js?

我的梦境 提交于 2019-12-25 02:34:28
问题 I've been working with RequireJS for a bit lately but I am brand new to the optimizer and I am trying to add it into my build steps but I am running into an issue. After it runs and merges my JS files into one, the body of my "main" no longer executes (worked fine prior to optimizing). All of the dependency JS loads correctly but the actual code inside of my main define() does not (even though I can see it in the final output file. Here is what I mean: Assuming simplified version of my main

How use Jquery-file-upload with backbone.js & require.js

谁说胖子不能爱 提交于 2019-12-25 02:25:47
问题 I have an backbone.js application who work with require.js and i want implement this following jquery plugin: https://github.com/blueimp/jQuery-File-Upload I have following this processus: https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin If anybody can send me an example of backbone app work with this plugin or can help me with other recommandations. Before you can read my code: Require.js config : require.config({ paths: { 'jquery' : 'common/vendors/jquery_2.1.0', 'underscore'

Backbone - Url's hash becomes empty on orientation change

与世无争的帅哥 提交于 2019-12-25 02:14:16
问题 I'm developing a Phonegap mobile application, using jQuery Mobile, Backbone and RequireJS. I configured jQM to let Backbone manage the routing. Whenever I change the orientation of the device, it seems that the whole layout is being rendered again (the first second or so, I can see just plain text, without the jQM visual enhancements and paging, and this happens when the app starts executing as well) and it goes to the first page, even though another one was being displayed. Did somebody