Skip to content

Commit

Permalink
Fix for absolute external node_modules dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
John McLaughlin committed Mar 24, 2016
1 parent 16f8edd commit 71116ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ function Webpack() {
if(m) return callback(null, `../server/${m[1]}.json`);
// externalise if the path begins with a node_modules name or if it's
// an absolute path containing /node_modules/ (the latter results from
// loopback middleware dependencies).
// loopback component and middleware dependencies).
const pathBase = request.split(/[\/\\]/)[0];
if(nodeModules.has(pathBase) || /[\/\\]node_modules[\/\\]/.test(request))
if(nodeModules.has(pathBase))
return callback(null, 'commonjs ' + request);
m = request.match(/[\/\\]node_modules[\/\\](.*)$/);
if(m)
return callback(null, 'commonjs ' + m[1].replace(/\\/g, '/'));
// otherwise internalise (bundle) the request.
callback();
};
Expand Down

0 comments on commit 71116ff

Please sign in to comment.