angular: Cannot build in --prod mode with registerLocaleData(fr);
I’m submitting a…
[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
when building in prod mode with this:
import fr from '@angular/common/locales/fr';
registerLocaleData(fr);
the build whit the --prod option will fail with the stack:
ERROR in chunk main [initial]
[name].[chunkhash:20].bundle.js
Cannot read property 'range' of null
TypeError: Cannot read property 'range' of null
at enterNode (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:146:15)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:125:24)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:134:24)
at enterNode (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:149:18)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:138:25)
at enterNode (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:149:18)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:125:24)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:134:24)
at enterNode (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:149:18)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:125:24)
at getPathInAst (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:134:24)
at info.moduleScope.variables.forEach.variable (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:536:23)
at Array.forEach (<anonymous>)
at modulesWithInfo.forEach.info (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:524:34)
at Array.forEach (<anonymous>)
at ConcatenatedModule.source (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:516:19)
Expected behavior
should build with --prod
Angular version: @angular/cli: 1.6.6 @angular/*: 5.2.2
Others: works with @angular/*: 5.2.1
reproduction: https://github.com/adrienboulle/test-prod-build
I have started a new project with the ng cli
and I have just added the registerLocaleData(fr)
thing.
I’ve tracked the issue to this commit:
https://github.com/angular/angular/commit/71f9eaa7432fa4e38d72211c0cf84e18f01561a7 (it works again when I modify juste /common/locales/fr.js
to it’s previous state)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 14
- Comments: 37 (17 by maintainers)
it will be resolved once the following PR lands in @angular/cli: https://github.com/angular/angular-cli/pull/9604 it will be out this week
@alexabbott , according to ocombe’s PR (#20624), you should modify your
tsconfig.app.json
as:I have tested this on my machine, and it works well.
this PR would fix it on our side: https://github.com/angular/angular/pull/20624
We have the same problem when we import
en
version… withde
only there is no problem.It happens only after upgrading from v5.2.1 to v5.2.2
@ocombe Great thx 😃 But it my pow the freq1:low is wrong, any project using i18n with the cli will be blocked to 5.2.1 until webpack and cli both update.