if ("production" !== process.env.NODE_ENV) { console.log('debug message'); } あらかじめビルド済みのreact.min.jsとかを使う場合はすでにproductionモードでビルドされてるので気にしなくていいけど、browserifyで自分でReactをビルドする場合はNODE_ENVを設定する必要がある。 のでproductionでは次のように環境変数を設定して実行するとよい。
Browserify による JavaScript コンパイルは便利だがファイルが増えてくると処理時間の長さがネックになる。3 秒を超えたあたりから gulp.watch で監視するにはきつくなる感じ。 スクリプト間の依存を解決しつつ *fy 系の処理もこなすのだから仕方ないともいえる。とはいえ、ひとつファイルを変更しただけで構成ファイル全体がコンパイルされるのは防ぎたい。そのためには差分コンパイルが必要だ。というわけで watchify を試してみる。 2015/5/20 補足 本記事と関連する記事として「gulp-watchify を試す」を書いた。こちらは gulp プラグインで Browserify/watchify を処理している。 watchify は Browserify をファイル監視つきで実行するためのモジュールである。コマンドライン ツール、Node モジュールとして利
$ npm install -g browserify envify $ broserfy -t [envify --GIT_HASH $(git rev-parse HEAD)] index.js > bundle.js Register as a new user and use Qiita more conveniently You get articles that match your needsYou can efficiently read back useful informationYou can use dark themeWhat you can do with signing up
Clone via HTTPS Clone with Git or checkout with SVN using the repository’s web address. browserify for webpack users There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack. Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more lik
Last month I talked about one of my favorite tools for JavaScript on the front end, Browserify, which allows you to create modular code for the browser using CommonJS modules and npm. It does this by combining the dependencies into an all-in-one bundle. In development, typically you will watch your JavaScript files for changes and then recompile the bundle. If you’re including some large dependenc
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く