Closed
Description
- OS?
Mac OSX El Capitan - Versions.
angular-cli: local (v1.0.0-beta.10, branch: webpack)
node: 4.4.7
os: darwin x64 - Repro steps.
I've pulled down the Angular-cli project and am building it locally, so I am using the new webpack version.
The project that I am building uses Crypto libraries (via a dependency of a dependency ...).
When I was runningng build
I was seeing the dependency built like this:
/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
var crypto = __webpack_require__(147);
var BufferUtil = __webpack_require__(21);
var $ = __webpack_require__(15);
var Hash = module.exports;
Hash.sha1 = function(buf) {
$.checkArgument(BufferUtil.isBuffer(buf));
return crypto.createHash('sha1').update(buf).digest();
};
...
And then when I looked at module 147 (I.E. the crypto module) I was seeing nothing there:
/***/ },
/* 147 */
/***/ function(module, exports, __webpack_require__) {
/***/ },
After a while of searching I took a look in the Angular-CLI code and saw that part of the webpack config (addon/ng2/models/webpack-build-common.ts) was this:
node: {
global: 'window',
crypto: 'empty',
module: false,
clearImmediate: false,
setImmediate: false
}
When I remove crypto: 'empty'
everything builds correctly with the crypto module getting pulled in.
So my question is, why have you specified that crypto should be empty?
Is there any way to fix this more permanently?