Skip to content

Cannot build in --prod mode with registerLocaleData(fr);  #21809

@adrienboulle

Description

@adrienboulle

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 ()
    at modulesWithInfo.forEach.info (/Users/adboul/Documents/repos/test-prod-build/node_modules/webpack/lib/optimize/ConcatenatedModule.js:524:34)
    at Array.forEach ()
    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:
71f9eaa (it works again when I modify juste /common/locales/fr.js to it's previous state)

Metadata

Metadata

Assignees

Labels

area: i18nIssues related to localization and internationalizationfreq2: mediumregressionIndicates than the issue relates to something that worked in a previous versiontype: bug/fixworkaround4: none

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions