browserify

Circular dependency issue with Typescript, CommonJS & Browserify

吃可爱长大的小学妹 提交于 2019-11-29 02:28:08
I'm in the process of moving a fairly large typescript project from internal modules to external modules. I do this because I want to create one core bundle, which, if and when required, can load other bundles. A seccond requirement which I'm keeping in mind is that I'd like to be able to run the bundles (with some modifications if required) on the server with nodeJS aswell. I first tried using AMD & require.js to build the core bundle, but I came across an issue with circular dependencies. After having reading that this is common with require.js and commonJS is more often adviced for large

How to use browserify to bundle a backbone app?

心不动则不痛 提交于 2019-11-28 21:34:36
I'm running into a little trouble with browserify. The Goal I'm trying to build the basic TodoMVC single-page app with Backbone, only instead of heaps of <script> tags in my index.html , I'm trying to bundle them all up with browserify. Here's what I have going so far. lib/models/todo.js var backbone = require("backbone"); var Todo = module.exports = backbone.Model.extend({ defaults: function() { return { title: "", completed: false, createdAt: Date.now(), }; }, }); lib/collections/todo.js var backbone = require("backbone"), LocalStorage = require("backbone.localstorage"); var TodoCollection =

How do I exclude the “require('react')” from my Browserified bundle?

北战南征 提交于 2019-11-28 20:30:00
I'm using Browserify to bundle a ReactJS application. All my components include a require("react") at the top. This causes Browserify to include the ReactJS source in my bundle. But I'd like to exclude it. How do I do that? Is this the right thing to do? @NickTomlin gave this answer, but then deleted it. You can use external : browserify --external react src.js > dest.js An example using the api: var bundler = browserify('src.js'); bundler.external('react'); bundler.bundle(); This is a viable option. external requires another script to provide the module in a compatible way. You can produce

Browserify - multiple entry points

耗尽温柔 提交于 2019-11-28 18:38:50
I am using Browserify within gulp. I am trying to compile down my tests to a single file as well. But unlike my main app, which I have working just fine, I am having trouble getting the tests to compile. The major difference is the tests have multiple entry points, there isn't one single entry point like that app. But I am getting errors fro Browserify that it can't find the entry point. browserify = require 'browserify' gulp = require 'gulp' source = require 'vinyl-source-stream' gulp.task 'tests', -> browserify entries: ['./app/js/**/*Spec.coffee'] extensions: ['.coffee'] .bundle debug: true

Should I use Browserify or Webpack for lazy loading of dependencies in angular 1.x [closed]

南笙酒味 提交于 2019-11-28 15:54:26
I would like to have async loading of angular dependencies in a large application and I'm trying to decide between Browserify or Webpack for this. I know angular 2.0 will support this natively but for now I'm looking for a well supported and popular solution. Can anyone give advice on which ones works best in an angular team and the most optimal way to structure the project. At my company, we've switched over from browserify to webpack for a multitude of reasons, lazy loading being one of them. Putting things in multiple bundles in browserify took some configuration changes as well as special

Create separate JavaScript bundles with a shared common library using Browserify and Gulp

这一生的挚爱 提交于 2019-11-28 15:21:30
For my team at work, I'm trying to set up a semi- automated JavaScript script and dependency management system with the help of Gulp and Browserify. I'm not even sure if what I'm trying to achieve is possible with the currently available set of tools (and my limited JavaScript knowledge). I believe what I'm trying to achieve is a pretty common scenario, but I haven't been able to find the information I've been looking for. Consider the following diagram: The lines indicate depedencies. For shared modules, such as Module-v and Module-y , I don't want the scripts to be duplicated by being

Task Runners (Gulp, Grunt, etc) and Bundlers (Webpack, Browserify). Why use together?

試著忘記壹切 提交于 2019-11-28 13:13:22
问题 I am a bit new to the task runner and bundler world and while going through things like Grunt, Gulp, Webpack, Browserify , I did not feel that there is much difference between them. In other words, I feel Webpack can do everything that a task runner does. But still I got a huge examples where gulp and webpack are used together. I couldn't figure out the reason why. Being new to this, I might be taking things in the wrong direction. It will be great if you could point out what I am missing.

React - Minified exception occurred

≡放荡痞女 提交于 2019-11-28 08:54:21
I have React js installed via NPM and using browserify to manage components in react. When an exception occurs in React, the console shows as "Uncaught Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings." How do I enable full error messages ? Setting NODE_ENV to development as Benjamin Gruenbaum pointed out in the comment resolved the issues. set NODE_ENV=development If you are encountering this issue with Karma + Webpack, the following Webpack configuration fixed the issue for me when running tests: plugins: [

Compacting node_modules for client-side deployment

只谈情不闲聊 提交于 2019-11-28 08:02:51
问题 I'm implementing a client-side application in JavaScript using Node.js. Because I will be deploying the software on many machines, I would like to minimize the size of the package I distribute. In particular, I would like to remove any unnecessary files from node_modules. For starters this means deduping and pruning the dependency tree, which npm can do for me. But I'd also like to remove all the package.json files and (especially) any other files that are not needed for deployment. In many

Using Bootstrap 3.0 with Browserify

笑着哭i 提交于 2019-11-28 07:26:26
I am trying to use Bootstrap 3.0 with Browserify 5.9.1, but getting the following error: Uncaught ReferenceError: jQuery is not defined What's the correct way to do this? Here are the relavant portions of my package.json: { ... "scripts": { "bundle": "browserify main.js -o bundle.js --debug --list" }, "dependencies": { "backbone": "~1.1.x", "jquery": "~2.1.x", "underscore": "~1.6.x" }, "devDependencies": { "browserify": "^5.9.1", ... }, ... } The module that requires bootstrap is shown below: var $ = require('jquery'); var Backbone = require('backbone'); Backbone.$ = $; require('../../../..