browserify

Getting Uncaught TypeError: fs.readdirSync is not a function when using Browserify with Nutritionix NodeJS client library

ε祈祈猫儿з 提交于 2019-12-10 13:39:15
问题 I'm trying to build a demo app using Node and I keep getting Uncaught TypeError: fs.readdirSync is not a function error when trying to use the Nutrionix NodeJS Client Library (https://github.com/nutritionix/nodejs-client-library) and Browserify. I'm following this tutorial http://www.sitepoint.com/getting-started-browserify/ up to the Using the Browserify Output section but instead of of using Underscore and the code provided for main.js, I'm using the Nutritionix NodeJS client library and

Uncaught ReferenceError: require is not defined on karma start karma.conf.js

丶灬走出姿态 提交于 2019-12-10 13:27:38
问题 Using Karma and Jasmine for unit testing on the angular front-end of a rails app. It appears I've done everything known to man to get through this error and I'm left with a million dependencies in my package.json. Here is my Karma.conf.js: module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter // list of files /

why is slick carousel not working with browserify?

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:17:44
问题 I'm trying to use slick carousel (http://kenwheeler.github.io/slick/) and installed via npm. Including it via browserify like this: slick = require('slick-carousel') trying to run like this: $('.gallery__carousel').slick(); No console errors, carousel not initialising. What's going on? 回答1: NOTE: It's not recommended to edit library. If still in case you want a workaround then you can follow like below. I also had the same problem with using slick with browserify but none of solutions worked

Testing CommonJS modules that use browserify aliases and shims

前提是你 提交于 2019-12-10 11:42:08
问题 Browserify allows creating aliases and shimming modules that are not directly CommonJS compatible. Since I'd like to run my tests in node CLI, can I somehow handle those aliases and shimmed modules in node? For example, let's say I'm aliasing ./my-super-module to supermodule and shimming and aliasing some jquery plugin ./vendor/jquery.plugin.js -> ./shims/jquery.plugin.shim.js to jquery.plugin . As a result, I can do this in my module: var supermodule = require('supermodule'); require('jquery

How to avoid long relative paths (../../../) with jasmine in different environments?

五迷三道 提交于 2019-12-10 11:30:07
问题 I am currently developing a project, which I want to test in different environments - including node.js and different browsers with karma/selenium - to avoid compatibility issues. (I think I will use browserify in browsers, but I am not familiar with it yet.) I have a nested testing directory, something like this: repo/ - project.js - project.my.module.js - spec/ -- helpers/ --- a.jasmine.helper.js -- support/ --- jasmine.json -- project.my.module/ --- ModuleClass.spec.js -- project.MyClass

Empty object require angular browserify

我们两清 提交于 2019-12-10 07:34:10
问题 I m facing a problem when I try to use bowserify, angularjs and coffeescript. In fact, when I try to require('angular'), I get an empty object : angular = require('angular') console.log angular ## return an empty object {} configuration = require('../../config/config') console.log configuration ## returns my fully config file correctly I dont know why it doesn't work properly in this case :-/. This is my package.json where I put the my personnal angular dependencies : { "dependencies": {

Gulp Typescript + Browserify; Bundled sourcemap points to transpiled JS rather than source TS

冷暖自知 提交于 2019-12-10 06:36:27
问题 I'm working on a Typescript project that is transpiled to ES5 JS and then run through browserify to create a single .js bundle and sourcemap. The bundled sourcemaps point to the transpiled JS rather than the source TS even though I am generating sourcemaps which properly point to the source TS when transpiling to JS. It's as if browserify is ignoring the existing sourcemaps pointing to the TS code and creating its own new maps to the transpiled JS code. Here are my gulp tasks for reference-

Browserifying react with addons to a standalone component, usable by plugins

核能气质少年 提交于 2019-12-10 04:04:54
问题 I am experementing a bit with react and browserify and have these wishes: I want to bundle all code written by me into a single file I want to bundle all 3rd party dependencies (react, react-router, lodash etc) into separate files, one for each lib, to maximize caching possibilities I have managed to do the things described above but I ran into this specific situation: In some places of my code I want to use react with addons and as such require it like this: var React = require('react/addons

How to import a npm package in an angular2 component?

我怕爱的太早我们不能终老 提交于 2019-12-10 01:54:55
问题 I'm trying to learn the ropes of ng2 and the depedency injection system is killing me. I'm using the ng quickstart from: https://github.com/angular/quickstart/blob/master/README.md I'm trying to import this package into the app: https://www.npmjs.com/package/arpad. I installed the package via npm update, my package.json dependencies look like this: "dependencies": { "angular2": "2.0.0-beta.9", "systemjs": "0.19.24", "es6-promise": "^3.0.2", "es6-shim": "^0.35.0", "reflect-metadata": "0.1.2",

Browserify fails to create bundle with babelify transform (TypeError: Path must be a string.)

╄→гoц情女王★ 提交于 2019-12-09 15:55:43
问题 I've written a gulp task to compile my .jsx and .js scripts into a bundle using watchify and babelify as a transform. For some reason my gulp script seems to be choking on the transform and I'm not sure why: gulp.task('browserify', function() { var bundle = watchify(browserify('./app/jsx/client/index.jsx', { extensions: ['.js', '.jsx'], debug: process.env.NODE_ENV === 'development' })); bundle.transform(babelify); bundle.on('update', function() { rebundle(bundle); }); function rebundle(bundle