browserify

Generating source maps from browserify using grunt

余生长醉 提交于 2019-12-04 09:58:58
问题 I have followed the instructions here: https://www.npmjs.org/package/grunt-browserify, to try and set up source maps for browserify on grunt. The options for browserify in my gruntfile are : browserify: { options: { bundleOptions : { debug: true } }, dist: { files: { "public/client.bundle.js": ["bundle.js"] } } } The generation of bundle.js happens without any issues, however the source map generation does not happen. Is there anything wrong with my grunt-browserify options. Thanks for

Chain Gulp glob to browserify transform

这一生的挚爱 提交于 2019-12-04 09:55:57
I have a project with a few relatively disjoint pages, each including their own entry point script. These scripts require a number of others using commonjs syntax, and need to be transformed by 6to5 and bundled by browserify. I would like to set up a gulp task that captures all the files matching a pattern and passes them on to the bundler, but I'm not sure how to pass files from gulp.src to browserify(filename) . My gulpfile looks like: var gulp = require("gulp"); var browserify = require("browserify"); var to5browserify = require("6to5-browserify"); var source = require("vinyl-source-stream"

How to improve webpack performance?

允我心安 提交于 2019-12-04 08:03:43
问题 I recently switched from browserify to webpack and the build time jumped from 4s to 16s on (2014 MBP). I understand webpack does alot more than browserify but i shouldn't take that long. My build process is fairly simple. Are there any tips or options to improve my build time? var webpackOptions = { cache : true, output: { filename: '[name].js', }, module: { loaders: [ { test: /\.js$/, loader: 'jsx-loader' }, { test: /\.css$/, loader: "style!css" } ] }, }; gulp.task('buildJs', function(){

Gulp, Reactify, and Babelify not transforming together

非 Y 不嫁゛ 提交于 2019-12-04 06:39:38
This is my gulpfile code: gulp.task('react', function () { browserify('app/src/main.jsx') .transform(reactify) .transform(babelify) .bundle() .pipe(source('app.js')) .pipe(streamify(uglify())) .pipe(gulp.dest('dist/js/')); }); Only the first transform statement runs, and therefor throws an error due to the lack of additional transform (I'm writing in ES6 and JSX w/ react). I'm at a complete loss and would really appreciate help. Reactify should no longer be used. You don't say what version you are on, but as of Babel 6 "preset's" are the standard way to achieve compilation. Run the following

How can I use factor-bundle with browserify programmatically?

风格不统一 提交于 2019-12-04 05:31:17
I want to use factor-bundle to find common dependencies for my browserify entry points and save them out into a single common bundle: https://www.npmjs.org/package/factor-bundle The factor-bundle documentation makes it seem very easy to do on the command line, but I want to do it programmatically and I'm struggling to get my head around it. My current script is this (I'm using reactify to transform react's jsx files too): var browserify = require('browserify'); var factor = require('factor-bundle') var glob = require('glob'); glob('static/js/'/**/*.{js,jsx}', function (err, files) { var bundle

翻遍互联网都找不到的解决方案,一行代码轻松实现 Gitbook 默认折叠左侧菜单效果

∥☆過路亽.° 提交于 2019-12-04 03:33:21
Gitbook 是一款 产品文档 构建工具,也可以用于构建个人博客,默认情况下电脑端访问时左侧菜单是展开状态,可偏偏有人想要实现 默认折叠 效果,于是诞生了这篇文章! 善良的我选择帮助别人 可能是网上关于 Gitbook 的教程相对来说有些落后,加上写文章时分享了不少关于 gitbook 系列教程 ,因此关注我的粉丝好友中有不少是来源于 Gitbook . 所以上个月有个好友问我能不能配置 Gitbook 默认折叠 的效果,心里有些犯难,作为 gitbook 的忠实粉丝,我都不知道 gitbook 还有这方面的配置?! 但是,善良的我总是有求必应, 不忍心拒绝 小白用户,于是我便抱着试一试的心态开始研究一下如何默认折叠? 当然, 解决问题前还是要先复现一下问题 ,然后在命令行中熟练敲入了 gitbook serve 命令来启动本地服务器,为了 排除缓存 等影响,特意打开了 Chrome 浏览器的 无痕模式 ,果不其然 默认左侧菜单是展开的 ! 「雪之梦技术驿站」: 不能复现的问题都不是我的问题, 拒绝解决此类问题 ,搞不好是你自己环境搭建问题呢! 蓦然回首官方文档已走 问题复现后就要开始寻求解决之道,虽然印象中并没有相关配置,但是难保记忆混乱遗漏了某些配置项,所以还是先看看 官方文档 怎么说的吧! 但是,当你在浏览器中输入 gitbook 官方文档 时,并找不到想象中的官方文档而是

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

杀马特。学长 韩版系。学妹 提交于 2019-12-04 03:25:39
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) { return bundle.bundle() .on('error', function(error) { console.log(error.stack, error.message); this

Browserify - ParseError: 'import' and 'export' may appear only with 'sourceType: module

▼魔方 西西 提交于 2019-12-04 03:13:44
问题 In my gulpfile I have var gulp = require('gulp'); var browserSync = require('browser-sync').create(); var sass = require('gulp-sass'); var babel = require("gulp-babel"); var rename = require('gulp-rename'); var source = require('vinyl-source-stream'); var browserify = require('gulp-browserify'); var notify = require("gulp-notify"); gulp.task('js', function () { gulp.src('js/main.js') .pipe(babel()) .pipe(browserify()) .on('error', errorAlert) .pipe(rename('./dist/js/bundle.js')) //.pipe

Adding bootstrap.js to browserify?

假如想象 提交于 2019-12-04 02:47:42
So I am trying to figure out how to do this? I downloaded bootstrap-sass via bower and added the bootstrap javascript into a shim. A few things have me confused, the bootstrap.js file looks like this. //= require bootstrap/affix //= require bootstrap/alert //= require bootstrap/button //= require bootstrap/carousel //= require bootstrap/collapse //= require bootstrap/dropdown //= require bootstrap/tab //= require bootstrap/transition //= require bootstrap/scrollspy //= require bootstrap/modal //= require bootstrap/tooltip //= require bootstrap/popover This is kind of self explanatory, but

How can I require a html template with Browserify

两盒软妹~` 提交于 2019-12-04 02:34:34
I'm trying to figure out an easy way to require a html template in the script and then run browserify from the CLI. Say I want to grab a template and append it to the body. //index.js var template = require('./template.html'); document.body.appendChild(template); and <!-- template.html --> <p>Woooo!</p> Then using the CLI to wrap it all up in Browserify. browserify index.js > build.js When loading an index.html template in the browser that references build.js I get this error in the console: Uncaught SyntaxError: Unexpected token < which is referencing .... },{}],3:[function(require,module