RSB
RSB

Reputation: 111

Can't bundle Angular 2 project with webpack

I am trying to bundle my Angular 2 project in production mode with webpack but I see no dist folder being produced and I am getting the following errors-

npm run build

[email protected] build C:\Users\Rennie\Projects\tour_of_heroes rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail 10% 0/3 build modulests-loader: Using [email protected] and C:\Users\Rennie\Projects\tour_of_heroes\tsconfig.json
17889918m11276ms optimize assets Hash: 7071423153409f1ffd44 Version: webpack 1.13.1 Time: 338789ms [280] ./app/app.component.js 2.72 kB {0} [built] ... -> factory:62ms building:188ms dependencies:31ms [313] ./app/suggestions.component.js 4.61 kB {0} [built] ... -> [280] 250ms -> factory:31ms building:2213ms dependencies:0ms [314] ./app/suggestion.js 472 bytes {0} [built] ... -> [280] 250ms -> [313] 2244ms -> factory:1097ms building:4725ms [315] ./app/suggestion.service.js 1.35 kB {0} [built] ... -> [280] 250ms -> [313] 2244ms -> factory:1097ms building:4725ms dependencies:0ms [316] ./app/mock-suggestions.js 354 bytes {0} [built] ... -> [280] 250ms -> [313] 2244ms -> [315] 5822ms -> factory:1748ms building:4998ms dependencies:0ms [317] ./app/projects.component.js 3.35 kB {0} [built] ... -> [280] 250ms -> factory:31ms building:2322ms dependencies:0ms [318] ./app/project.service.js 1.31 kB {0} [built] ... -> [280] 250ms -> [317] 2353ms -> factory:988ms building:4741ms dependencies:0ms [319] ./app/mock-projects.js 443 bytes {0} [built] ... -> [280] 250ms -> [317] 2353ms -> [318] 5729ms -> factory:1732ms building:4998ms [320] ./app/project.js 424 bytes {0} [built] ... -> [280] 250ms -> [317] 2353ms -> [318] 5729ms -> [319] 6730ms -> factory:1226ms building:1816ms [321] ./app/tech.service.js 1.26 kB {0} [built] ... -> [280] 250ms -> [317] 2353ms -> factory:988ms building:4959ms dependencies:0ms [322] ./app/mock-tech.js 710 bytes {0} [built] ... -> [280] 250ms -> [317] 2353ms -> [321] 5947ms -> factory:2276ms building:4268ms + 888 hidden modules

WARNING in app.7071423153409f1ffd44.js from UglifyJs Condition always true [./main.ts:5,4]

WARNING in polyfills.7071423153409f1ffd44.js from UglifyJs Condition always true [./polyfills.ts:4,4] Dropping unreachable code [./polyfills.ts:8,2] Side effects in initialization of unused variable anInstance [./~/core-js/modules/es6.number.to-fixed.js:3,0] Side effects in initialization of unused variable anObject [./~/core-js/modules/es6.promise.js:8,0] Side effects in initialization of unused variable setProto [./~/core-js/modules/es6.promise.js:12,0] Side effects in initialization of unused variable hide [./~/core-js/modules/_collection-strong.js:4,0] Side effects in initialization of unused variable has [./~/core-js/modules/es6.weak-map.js:8,0] Side effects in initialization of unused variable TYPED_ARRAY [./~/core-js/modules/es6.typed.array-buffer.js:9,0] Side effects in initialization of unused variable parseInt [./~/core-js/modules/_typed-buffer.js:24,0] Side effects in initialization of unused variable min [./~/core-js/modules/_typed-buffer.js:30,0] Side effects in initialization of unused variable isInteger [./~/core-js/modules/_typed-array.js:14,0] Side effects in initialization of unused variable isIterable [./~/core-js/modules/_typed-array.js:28,0] Condition left of || always false [./~/zone.js/dist/zone.js:600,40] Condition left of || always false [./~/zone.js/dist/zone.js:601,39] Dropping side-effect-free statement [./~/zone.js/dist/zone.js:629,0] Side effects in initialization of unused variable Zone [./~/zone.js/dist/zone.js:152,0] Dropping unused variable cacheSentinel [./~/reflect-metadata/Reflect.js:809,0] Condition always false [(webpack)/~/node-libs-browser/~/buffer/~/base64-js/lib/b64.js:124,1]

WARNING in vendor.7071423153409f1ffd44.js from UglifyJs Dropping unused variable __unused [./~/@angular/core/src/di/reflective_injector.js:9,0] Side effects in initialization of unused variable freeExports [./~/rxjs/util/root.js:12,0] Side effects in initialization of unused variable freeModule [./~/rxjs/util/root.js:13,0] Side effects in initialization of unused variable SecurityContext [./~/@angular/core/src/security.js:17,0] Side effects in initialization of unused variable ViewType [./~/@angular/core/src/linker/view_type.js:13,0] Dropping unused variable __unused [./~/@angular/core/src/platform_common_providers.js:10,0] Dropping unused variable __unused [./~/@angular/core/src/application_common_providers.js:8,0] Side effects in initialization of unused variable ProviderAstType [./~/@angular/compiler/src/template_ast.js:224,0] Side effects in initialization of unused variable PropertyBindingType [./~/@angular/compiler/src/template_ast.js:261,0] Side effects in initialization of unused variable OPERATORS [./~/@angular/compiler/src/expression_parser/lexer.js:422,0] Dropping unused variable $FF [./~/@angular/compiler/src/html_lexer.js:69,0] Dropping unused variable $$ [./~/@angular/compiler/src/html_lexer.js:75,0] Dropping unused variable $QUESTION [./~/@angular/compiler/src/html_lexer.js:87,0] Non-strict equality against boolean: != true [./~/@angular/compiler/src/html_tags.js:295,0] Side effects in initialization of unused variable TypeModifier [./~/@angular/compiler/src/output/output_ast.js:12,0] Side effects in initialization of unused variable BuiltinMethod [./~/@angular/compiler/src/output/output_ast.js:268,0] Side effects in initialization of unused variable StmtModifier [./~/@angular/compiler/src/output/output_ast.js:502,0] Dropping unused variable EVENT [./~/@angular/compiler/src/schema/dom_element_schema_registry.js:12,0] Dropping unused variable __unused [./~/@angular/common/src/pipes/async_pipe.js:28,0] Non-strict equality against boolean: == false [./~/@angular/router-deprecated/src/router.js:532,0] Non-strict equality against boolean: == false [./~/@angular/router-deprecated/src/router.js:315,0] Dropping unused variable __make_dart_analyzer_happy [./~/@angular/router-deprecated/src/route_config/route_config_impl.js:7,0] Side effects in initialization of unused variable RequestMethod [./~/@angular/http/src/enums.js:14,0] Side effects in initialization of unused variable ReadyState [./~/@angular/http/src/enums.js:28,0] Side effects in initialization of unused variable ResponseType [./~/@angular/http/src/enums.js:40,0]

ERROR in C:\Users\Rennie\Projects\tour_of_heroes\node_modules\reflect-metadata\Reflect.ts (1406,33): error TS2304: Cannot find name 'msCrypto'.

ERROR in C:\Users\Rennie\Projects\tour_of_heroes\node_modules\reflect-metadata\Reflect.ts (1407,21): error TS2304: Cannot find name 'msCrypto'.

My code does work on development mode.

My code can be found here at this repo- Portfolio Project

Upvotes: 4

Views: 621

Answers (1)

AniketGole
AniketGole

Reputation: 1285

Update your webpack version will solve this

Upvotes: 1

Related Questions