require

Webpack ProvidePlugin vs externals?

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm exploring the idea of using Webpack with Backbone.js . I've followed the quick start guide and has a general idea of how Webpack works, but I'm unclear on how to load dependency library like jquery / backbone / underscore. Should they be loaded externally with or is this something Webpack can handle like RequireJS's shim? According to the webpack doc: shimming modules , ProvidePlugin and externals seem to be related to this (so is bundle! loader somewhere) but I cannot figure out when to use which. Thanks 回答1: It's both

Using cluster in an Expressjs app

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm doing a little OJT on my first node project and, while I can stand up a simple server, the app is going to get hammered so using cluster seems like a good idea. I've cobbled together some code snippets that I've found in various searches (including SO), but the server won't start. I'm sure my inexperience with node has me doing something stupid, but I don't see it. var express = require( 'express' ); var cluster = require( 'cluster' ); var path = require( 'path' ); var cCPUs = require( 'os' ).cpus().length; var port = 3000; var root =

Error: jQuery requires a window with a document

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So everything was working just fine and great until doing npm update and now things do not work quite as they used to. A little background: in my code I use jquery to parse textual html. I do not use a window and I don't use jsdom. It used to work just fine to do this: $ = require("jquery"); $(html).find(" ").html("The title"); But now I get this: jQuery requires a window with a document How do I fix this? 回答1: node.js-jQuery definition in one line: // definition var $ = require('jquery')(require("jsdom").jsdom().parentWindow); // usage $(

vuejs router - Require is not defined

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to get started with this: https://github.com/vuejs/vue-router I have cloned the package, and followed the instructions to build: npm install npm run build But I am receiving a "Require is not defined" error on: var Vue = require('vue') var VueRouter = require('../src') in /example/example.js I have installed node and browserify... Not sure what to do. 回答1: Have you done the following after you installed Browserify? 1) bundle all your .js files into one file (e.g. 'bundle.js') using command: browserify example/example.js -o bundle

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

匿名 (未验证) 提交于 2019-12-03 02:35:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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"; Object.defineProperty(exports, "__esModule", {

Way to require an autoload in one file on a Prestashop module?

匿名 (未验证) 提交于 2019-12-03 02:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use a set of libraries with Composer for a Prestashop module. My current approach is to include the vendor/autoload.php file on every file ( mymodule.php , controllers/front/foo.php , controllers/admin/bar.php , etc.) Doing the require only on top of the mymodule.php is not a solution, I don't see any hook to do the task. Is there a better approach than copy & paste the same snippet on top of every PHP file? Thank you! 回答1: I've found the way to do it! The actionDispatcher hook was working for me with models, hooks, but not

kernel_require.rb:55:in `require': cannot load such file error

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Ruby version 1.9.3 at the moment (although I get the same issue with Ruby 2.0.0). On Windows 7 64-bit. I'm following 'The Cucumber Book' and got stuck at the chapter 7.2 - "Removing Duplication with Transforms". My folder structure is as follows: \cash_withdrawal \cash_withdrawal\Gemfile \cash_withdrawal\Gemfile.lock \cash_withdrawal\features \cash_withdrawal\features\cash-withdrawal.feature \cash_withdrawal\features\step_definitions \cash_withdrawal\features\step_definitions\cash_withdrawal_steps.rb \cash_withdrawal\features\step

how to use express-ntlm to get windows user name without authentication using NODE.js?

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to use express-ntlm to get windows user name without authentication. in my app.js, i put the following: var app = express (); // view engine setup app . set ( 'views' , path . join ( __dirname , 'views' )); app . set ( 'view engine' , 'jade' ); app . use ( favicon ()); app . use ( logger ( 'dev' )); app . use ( bodyParser . json ()); app . use ( bodyParser . urlencoded ()); app . use ( cookieParser ()); app . use ( express . static ( path . join ( __dirname , 'public' ))); app . use ( '/' , routes ); var ntlm = require

webpack with less and postcss autoprefixer

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to webpack and I'm trying to set everything up to work on a react project. I have managed to get everything working in webpack as expected but have hit a road block with autoprefixer. I have followed the docs for both post css and autoprefixer and I'm obviously missing something important here or have done something daft. can you please take a look at my config and let me know if you have any suggestions. Other postcss plugins are working fine like nanocss. althought I have tried cssnext as I think that includes autoprefixer anyway.

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

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 world' export = b and where require.d.ts and node.d