Skip to content

Commit 0efc7e8

Browse files
committed
fix(@angular/cli): in ng serve prefix historyApiFallback.index with deployUrl
when implementing i18n following https://angular.io/docs/ts/latest/cookbook/i18n.html and https://medium.com/@feloy/deploying-an-i18n-angular-app-with-angular-cli-fc788f17e358 when running in `development` to be consistent with `production` I am using ``` ng serve --deploy-url /en/ --base-href /en/ \ --aot --locale en --i18n-file ./src/locale/messages.en.xlf ``` running the app this way, on routes other than `http://localhost:4200/en/` the `webpack-dev-server` was always saying that the route is not found, so this commit fixes that
1 parent 0de9cb6 commit 0efc7e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/@angular/cli/tasks/serve.ts

+2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export default Task.extend({
177177
// set publicPath property to be sent on webpack server config
178178
if (serveTaskOptions.deployUrl) {
179179
webpackDevServerConfiguration.publicPath = serveTaskOptions.deployUrl;
180+
(webpackDevServerConfiguration.historyApiFallback as any).index =
181+
serveTaskOptions.deployUrl + `/${appConfig.index}`;
180182
}
181183

182184
if (serveTaskOptions.target === 'production') {

0 commit comments

Comments
 (0)