Skip to content

Commit

Permalink
fix(builtin): process/browser should resolve from browserify
Browse files Browse the repository at this point in the history
Previously I marked the action local:1 but this masked a real failure in downstream project
We can workaround the linked ncc issue to make browserify run correctly
  • Loading branch information
alexeagle committed Jul 15, 2019
1 parent 1e156e6 commit a98eda7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions internal/npm_install/npm_umd_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ def _npm_umd_bundle(ctx):
inputs = inputs,
outputs = [output],
arguments = [args],
# browserify may load files from nodejs but these aren't declared as action inputs
# looks like:
# ERROR: /workdir/internal/npm_install/test/BUILD.bazel:50:1: Couldn't build file internal/npm_install/test/sinon.umd.js: Generated UMD bundle for sinon npm package [browserify] failed (Exit 1)
# Error: Cannot find module 'process/browser.js' from '/b/f/w/bazel-out/host/bin/external/build_bazel_rules_nodejs/internal/npm_install/browserify-wrapped.runfiles/build_bazel_rules_nodejs/third_party/github.com/browserify/browserify
# TODO(alexeagle): remove this line and make the tests work with RBE
execution_requirements = {"local": "1"},
)

return [
Expand Down
3 changes: 3 additions & 0 deletions scripts/vendor_browserify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ echo "Compiling browserify with ncc"
echo "Local mod: revert https://github.com/browserify/browserify/pull/1801"
sed -i 's#parent.id !== self._mdeps.top.id#parent.id#' third_party/github.com/browserify/browserify/index.js

echo "Local mod: workaround https://github.com/zeit/ncc/issues/461"
sed -i "s#require('process/browser.js')#require('./browser1')#" third_party/github.com/browserify/browserify/main.js

echo "Copy LICENSE"
cp -f ./node_modules/browserify/LICENSE ./third_party/github.com/browserify/browserify

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var nextTick = require('process/browser.js').nextTick;
var nextTick = require('./browser1').nextTick;
var apply = Function.prototype.apply;
var slice = Array.prototype.slice;
var immediateIds = {};
Expand Down

0 comments on commit a98eda7

Please sign in to comment.