-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): add sourceMappingURL comment for …
…ES2015 during differential loading When having differential loading enabled we only add the `sourceMappingURL` comment when optimization is enabled, because we only process these bundles when we enabling optimization. With this change we now process such bundles even when optimization is disabled and add `sourceMappingURL` when source maps are enabled and not hidden. Closes #16522
- Loading branch information
1 parent
0248f1d
commit f08d79b
Showing
5 changed files
with
139 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as fs from 'fs'; | ||
import { ng } from '../../utils/process'; | ||
|
||
export default async function () { | ||
await ng('build', '--prod', '--output-hashing=none', '--source-map', 'false'); | ||
await testForSourceMaps(6); | ||
|
||
await ng('build', '--output-hashing=none', '--source-map', 'false'); | ||
await testForSourceMaps(8); | ||
} | ||
|
||
async function testForSourceMaps(expectedNumberOfFiles: number): Promise <void> { | ||
const files = fs.readdirSync('./dist/test-project'); | ||
|
||
let count = 0; | ||
for (const file of files) { | ||
if (!file.endsWith('.js')) { | ||
continue; | ||
} | ||
|
||
++count; | ||
|
||
if (files.includes(file + '.map')) { | ||
throw new Error('Sourcemap generated for ' + file); | ||
} | ||
|
||
const content = fs.readFileSync('./dist/test-project/' + file, 'utf8'); | ||
if (content.includes(`//# sourceMappingURL=${file}.map`)) { | ||
throw new Error('Sourcemap comment found generated for ' + file); | ||
} | ||
} | ||
|
||
if (count < expectedNumberOfFiles) { | ||
throw new Error(`Javascript file count is low. Expected ${expectedNumberOfFiles} but found ${count}`); | ||
} | ||
} |
Oops, something went wrong.