angular-cli
angular-cli copied to clipboard
file hash different when building with and without sourcemaps when buildOptimizer set to true
🐞 Bug report
Command (mark with an x
)
- [x] build
Description
The difference in bundle hash when "buildOptimizer": true
and hence the bundle itself.
I am building the application with and without sourcemaps (2 times), here is the snippet of the configurations
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "6mb"
}
]
},
"srcmap": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": {
"hidden": true,
"scripts": true,
"styles": true
},
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "6mb"
}
]
}
}
Notice that, I have two configurations production
and srcmap
with "buildOptimizer": true
the only difference is the sourcemap. where
-
production
:sourceMap: false
-
srcmap
:"sourceMap": { "hidden": true, "scripts": true,"styles": true }
If I run, ng build --prod
and ng build --configuration=srcmap
I get bundles with difference in their hashes.
According to the following issue, the above said bug shouldn't be happening because I am already using hidden sourcemap
related to https://github.com/angular/angular-cli/issues/8981
When I change to buildOptimizer: false
in both production
and srcmap
then I run the build for both and then I get similar bundles.
Maybe related https://github.com/angular/angular-cli/issues/8981#issuecomment-356658544