After I've updated to Angular6 and updated @ngtools/webpack
from "6.0.0-beta.8" to "6.1.2" I found that hostReplacementPaths option does not work anymore.
Normally it replaces correct env files:
new AngularCompilerPlugin({
...
hostReplacementPaths: {
'environments/environment.ts': environmentFiles[NODE_ENV]
},
...
})
But now it does not.
I made deep debug into @ngtools/webpack and found that normalize
function here
https://github.com/angular/angular-cli/blob/master/packages/ngtools/webpack/src/virtual_file_system_decorator.ts#L188
does not work
still could not find what went wrong with it. maybe somebody already solved this issue?
Created an issue in angular-cli repo - https://github.com/angular/angular-cli/issues/11801
Looks like will be fixed soon by this PR - https://github.com/angular/angular-cli/pull/11809
As James mentioned, there was a bug introduced in
6.1.0-rc.2
by this commit: https://github.com/angular/angular-cli/commit/86a62adbe8faeb4628296d5d6915c54e6dbfd85bPaths were not resolved properly.
Before:
Suggested fix: