Closed
Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, this is a kind of regression. I'm not sure about the root cause, it worked well in one of my previous setups with earlier RC versions. This might be as regression in AngularCli itself or because of different babel versions which I might install.
Description
An error:
Localized bundle generation failed: [BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is called directly,
`
babel.transform(code, { filename: 'file.ts', presets: [/* your preset */] });
`
See https://babeljs.io/docs/en/options#filename for more information.
An error occurred inlining file "main.bd935ccfc875481a7ad2.js"
The error came from packages/angular_devkit/build_angular/src/utils/process-bundle.ts:614
try {
ast = parseSync(options.code, { // <--- Error here
babelrc: false,
sourceType: 'script',
});
} catch (error) {
if (error.message) {
...
}
}
And obviously caused by lacking filename
param.
🔬 Minimal Reproduction
To reproduce just add locales into angular.json
i18n.locales
and turn on localize
in project options
(simplified angular.json)
{
"projects": {
"timescenery": {
"i18n": {
"locales": {
"ru": "src/translates/messages.ru.xlf",
"de": "src/translates/messages.de.xlf",
"es": "src/translates/messages.es.xlf",
"pt": "src/translates/messages.pt.xlf"
},
"sourceLocale": "en"
},
"architect": {
"build": {
"options": {
"localize": true,
"aot": true,
},
},
}
}
}
}
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.0-rc.10
Node: 12.13.1
OS: darwin x64
Angular: 9.0.0-rc.11
... common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, upgrade
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.0-rc.10
@angular-devkit/build-angular 0.900.0-rc.10
@angular-devkit/build-optimizer 0.900.0-rc.10
@angular-devkit/core 9.0.0-rc.10
@angular-devkit/schematics 9.0.0-rc.10
@angular/cdk 9.0.0-rc.8
@angular/cli 9.0.0-rc.10
@schematics/angular 9.0.0-rc.10
@schematics/update 0.900.0-rc.10
rxjs 6.5.3
typescript 3.7.2
webpack 4.41.5
Anything else relevant?