Wednesday 17 May 2017

Webpack build failed on Angular 2

Trying to build an Angular 2 project with Webpack. I have the following error and not dist folder on the directory.

[at-loader] Checking finished with 2 errors
Error in bail mode: [at-loader] ./src/app/documents/documents.service.ts:101:7 
    TS2322: Type 'string' is not assignable to type 'Date'.

npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/bin/npm" "run" "build:prod"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! Sing@3.4.0 build:prod: `webpack --config config/webpack.prod.js  --progress --profile --bail`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the Sing@3.4.0 build:prod script 'webpack --config config/webpack.prod.js  --progress --profile --bail'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Sing package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --config config/webpack.prod.js  --progress --profile --bail
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Sing
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Sing
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     ...../npm-debug.log

The error that is mentioned is on those lines:

  document.expired = this._datepipe.transform(document.expired, 'yyyy-MM-dd');
  document.published = this._datepipe.transform(document.published, 'yyyy-MM-dd');

I just change the date format. While I am on dev with npm start everything works great and the above part of the code doesn't raise any error. It is happening only on production build.

Any idea what I can do to fix it?



via Tasos

No comments:

Post a Comment