browserify

gulp, browserify, maps?

二次信任 提交于 2019-11-26 21:22:04
问题 How do I enable source maps? I'm doing this: var browserify = require("gulp-browserify") gulp.task("compile:client", function() { gulp.src("src/client/app.coffee", { read: false }) .pipe(browserify({ debug: true // THIS DOES NOTHING :( transform: ['coffeeify'], extensions: ['.coffee'] })) .pipe(rename('app.js')); }); Ouch... for some reason on the github page for gulp-browserify it says: PLUGIN IS BLACKLISTED. I don't get it... how the heck I'm suppose to use browserify with my coffeescript

Browserifying libraries that were themselves browserified: relative paths error

余生颓废 提交于 2019-11-26 21:20:41
问题 I want to use a library that was build using browserify. The library built correctly and works fine when it is used by itself. Now that built library is in my vendors/ directory, and I try to require it in my new application: var myLib = require('./vendors/myLib'); When I try to browserify my application, it complains that it can't find some of the internal require statements inside that library: Error: Cannot find module '../utils/logger' from '/myApp/vendor' Browserify seems to be trying to

Compiling dynamically required modules with Browserify

一曲冷凌霜 提交于 2019-11-26 20:57:57
问题 I am using Browserify to compile a large Node.js application into a single file (using options --bare and --ignore-missing [to avoid troubles with lib-cov in Express]). I have some code to dynamically load modules based on what is available in a directory: var fs = require('fs'), path = require('path'); fs.readdirSync(__dirname).forEach(function (file) { if (file !== 'index.js' && fs.statSync(path.join(__dirname, file)).isFile()) { module.exports[file.substring(0, file.length-3)] = require

Browserify with require('fs')

限于喜欢 提交于 2019-11-26 20:46:42
I was trying to use browserify on a file that uses the fs object. When I browserify it, the call to require('fs') doesn't get transformed and require returns {} . Is there any workaround for this? I've seen some suggestions on stackoverlow and elsewhere, but none seem to be fully realized. I actually hoped to create a google web packaged app using browserify for a class I teach. Thanks in advance. Which filesystem should the browser use then? The HTML5 filesystem is not really comparable to a traditional filesystem. It doesn't have symlinks, and it is only accessible asynchronously outside Web

Catching Browserify parse error (standalone option)

北城余情 提交于 2019-11-26 20:35:17
问题 I'm using gulp + browserify to build and package my javascript library. Now there is one thing that bothers me: I'm running a simple server with livereload for development via gulp. This works fine, but whenever my javascript contains a syntax error, browserify throws an error causing the server to stop. The browserify code I use (note that I've added an error handler): browserify("./src/main.js") .bundle({standalone: "SomeName", debug: false}).on('error', notify.onError({ message: "Error: <%

Babelify throws ParseError on import a module from node_modules

那年仲夏 提交于 2019-11-26 20:08:00
问题 I'm working with Babelify and Browserify. Also, I'm using ES6 style module features by node module system. I would like to put all my own modules into node_modules/libs . For instance: test.js in node_modules/libs export default () => { console.log('Hello'); }; main.js (will be compiled to bundle.js ) import test from 'libs/test'; test(); After that, I have compiled the above codes to bundle.js with this command: browserify -t babelify main.js -o bundle.js But unfortunately, I have got some

What is the difference between browserify/requirejs modules and ES6 modules [closed]

£可爱£侵袭症+ 提交于 2019-11-26 18:51:35
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'm still new to ES6 and module loaders and I'm currently looking at combining a browserify setup with ES6. I was wondering if I would still need browserify/requirejs if I'm using ES6 modules. Seems like both allow you to define modules and export them? What is the difference

How to import part of object in ES6 modules

℡╲_俬逩灬. 提交于 2019-11-26 17:47:47
问题 In the react documentation I found this way to import PureRenderMixin var PureRenderMixin = require('react/addons').addons.PureRenderMixin; How can it be rewritten in ES6 style. The only thing I can do is: import addons from "react/addons"; let PureRenderMixin = addons.addons.PureRenderMixin; I hope there is a better way. 回答1: Unfortunately import statements does not work like object destructuring. Curly braces here mean that you want to import token with this name but not property of default

require is not defined error with browserify

隐身守侯 提交于 2019-11-26 15:46:47
问题 I'm new to browserify and trying to load npm modules in browser but I'm getting the following error: Uncaught ReferenceError: require is not defined I'm following the tutorial from http://browserify.org/. Created javascript file with the following content: var unique = require('uniq'); then run npm install uniq and browserify main.js -o bundle.js the bundle.js file is generated and I included it in my html but still getting the above error. Any ideas what am I doing wrong? This is the content

Browserify, Babel 6, Gulp - Unexpected token on spread operator

南笙酒味 提交于 2019-11-26 15:22:24
I'm trying to get my Browserify/Babelify/Gulp working in my project, but it won't take the spread operator. I got this error from my gulpfile: [SyntaxError: /Users/mboutin2/Desktop/Todo-tutorial/src/reducers/grocery-list-reducers.js: Unexpected token (16:8) while parsing file: /Users/mboutin2/Desktop/Todo-tutorial/src/reducers/grocery-list-reducers.js] This is my gulpfile.js var gulp = require('gulp'); var source = require('vinyl-source-stream'); var browserify = require('browserify'); var sourcemaps = require('gulp-sourcemaps'); var uglify = require('gulp-uglify'); var buffer = require('vinyl