date pipe not working on AOT and rollup #11643

Closed
diego0020 opened this Issue Sep 15, 2016 · 7 comments

Comments

Projects
None yet
8 participants
@diego0020

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
date Pipe is not working after AOT compilation. It works perfectly using JIT and systemJS but produces an error in AOT mode after following the AOT cookbook
Expected behavior
date pipe should work the same as in AOT as in JIT mode.

Reproduction of the problem
This is a small project based on the quickstart
https://github.com/diego0020/ng2_date_test

run

npm install
node_modules/.bin/ngc -p tsconfig-aot.json
node_modules/.bin/rollup -c rollup.js
npm run lite

Please tell us about your environment:
OSX El capitan, lite server

  • Angular version: 2.0.0
  • Browser: [Chrome 52.0.2743.116 (64-bit)]
  • Language: [TypeScript 2.0.2 ]
  • Node (for AoT issues): node --version = 6.5.0

Related stack overflow question
https://stackoverflow.com/questions/39379090/angular2-rc6-inject-locale-id-fails-after-bundling

Possible cause

It appears the LOCALE_ID parameter is not correctly set when running ngc.
also tried by adding --locale=en_US to ngc but the problem remains.

The chrome console shows that localeis nullon ints.ts function dateFormatter.

Maybe related to this pr #10622

@pkozlowski-opensource

This comment has been minimized.

Show comment
Hide comment
@pkozlowski-opensource

pkozlowski-opensource Sep 15, 2016

Member

Actually sounds similar / the same as #11642

Actually sounds similar / the same as #11642

@vicb

This comment has been minimized.

Show comment
Hide comment
@vicb

vicb Sep 15, 2016

Member

the workaround for now is to specify a locale when you compile your appli:

node_modules/.bin/ngc -p tsconfig-aot.json --locale=en-US

The PR is in the pipe.

Member

vicb commented Sep 15, 2016

the workaround for now is to specify a locale when you compile your appli:

node_modules/.bin/ngc -p tsconfig-aot.json --locale=en-US

The PR is in the pipe.

@diego0020

This comment has been minimized.

Show comment
Hide comment
@diego0020

diego0020 Sep 15, 2016

The workaround works, thanks

diego0020 commented Sep 15, 2016

The workaround works, thanks

vicb added a commit to vicb/angular that referenced this issue Sep 15, 2016

qdouble added a commit to qdouble/angular-webpack-starter that referenced this issue Sep 16, 2016

@qdouble qdouble referenced this issue in qdouble/angular-webpack-starter Sep 16, 2016

Merged

Aot updates #12

qdouble added a commit to qdouble/angular-webpack-starter that referenced this issue Sep 16, 2016

AOT updates
* set locale to work around AOT pipe bug
angular/angular#11643

* move AOT tsconfig file and adjust paths
@erwinwildenburg

This comment has been minimized.

Show comment
Hide comment
@erwinwildenburg

erwinwildenburg Sep 17, 2016

The workaround doesn't work for me, the same error is showing...

EDIT: Nevermind I'm an idiot :D

erwinwildenburg commented Sep 17, 2016

The workaround doesn't work for me, the same error is showing...

EDIT: Nevermind I'm an idiot :D

@alexeagle alexeagle closed this in 03aedbe Sep 19, 2016

@xealot

This comment has been minimized.

Show comment
Hide comment
@xealot

xealot Sep 19, 2016

This comment is hard to find... For future google visitors:

Cannot read property 'LOCALE_ID' of undefined is how this problem manifested for me.

xealot commented Sep 19, 2016

This comment is hard to find... For future google visitors:

Cannot read property 'LOCALE_ID' of undefined is how this problem manifested for me.

@reservoir-dogs

This comment has been minimized.

Show comment
Hide comment
@reservoir-dogs

reservoir-dogs Sep 12, 2017

LOCALE_ID use InjectionToken.
With AOT compilation, the InjectionToken does not work. Is it a bug ?
I added #19154

reservoir-dogs commented Sep 12, 2017

LOCALE_ID use InjectionToken.
With AOT compilation, the InjectionToken does not work. Is it a bug ?
I added #19154

@imnickvaughn

This comment has been minimized.

Show comment
Hide comment
@imnickvaughn

imnickvaughn Feb 18, 2018

I too am having trouble with pipes. Its the currency pipe though. Manifesting as the $ sign not being rendered but is rendered in https://stackblitz.com/ with the same code. Maybe this post helps someone figure it out.

I too am having trouble with pipes. Its the currency pipe though. Manifesting as the $ sign not being rendered but is rendered in https://stackblitz.com/ with the same code. Maybe this post helps someone figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment