angular-cli: Compilation crash: `Error: Content and Map of this Source is not available (only size() is supported)`
🐞 Bug report
Command (mark with an x
)
- build
- serve
Is this a regression?
Yes, didn’t see this with Angular 12.
Description
I’m running into Error: Content and Map of this Source is not available (only size() is supported) with Angular.
This seems to have been reported in various other places recently: stackoverflow.com/questions/70066980/angular-12-content-and-map-of-this-source-is-not-available-only-size-is-suppo
I’m not sure if this is an Angular or Webpack issue, I also crossposted this to webpack: https://github.com/webpack/webpack/issues/14840
🔬 Minimal Reproduction
I don’t have a clear reproduction, however I was able to add some logs in emitAsset
here, which is part of the stack trace:
https://github.com/webpack/webpack/blob/14582fc41504595b04f01561ea19d27391d6b9ac/lib/Compilation.js#L4171-L4176
I added:
emitAsset(file, source, assetInfo = {}) {
if (this.assets[file]) {
try {
!isSourceEqual(this.assets[file], source);
} catch (err) {
console.error(file, this.assets[file], source);
throw err;
}
The output before the crash is:
fontawesome-webfont.eot SizeOnlySource { _size: 165742 } RawSource {
_valueIsBuffer: true,
_value: <Buffer 6e 87 02 00 ac 86 02 00 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 90 01 00 00 00 00 4c 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 165692 more bytes>,
_valueAsBuffer: <Buffer 6e 87 02 00 ac 86 02 00 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 90 01 00 00 00 00 4c 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 165692 more bytes>,
_valueAsString: undefined
}
It always seems to crash on the same eot
file. Notice that this.assets[file]
for this file is a SizeOnlySource
.
🔥 Exception or Error
.../node_modules/webpack-sources/lib/SizeOnlySource.js:16
return new Error(
^
Error: Content and Map of this Source is not available (only size() is supported)
at SizeOnlySource._error (.../node_modules/webpack-sources/lib/SizeOnlySource.js:16:10)
at SizeOnlySource.buffer (.../node_modules/webpack-sources/lib/SizeOnlySource.js:30:14)
at _isSourceEqual (.../node_modules/webpack/lib/util/source.js:21:51)
at isSourceEqual (.../node_modules/webpack/lib/util/source.js:43:17)
at Compilation.emitAsset (.../node_modules/webpack/lib/Compilation.js:4155:9)
at .../node_modules/webpack/lib/Compiler.js:546:28
at .../node_modules/webpack/lib/Compiler.js:1127:17
at eval (eval at create (.../node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
The terminal process "zsh '-c', 'yarn run start'" terminated with exit code: 1.
🌍 Your Environment
Angular CLI: 13.0.2
Node: 16.13.0
Package Manager: yarn 3.1.0
OS: darwin arm64
Angular: 13.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router, service-worker
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.2
@angular-devkit/build-angular 13.0.2
@angular-devkit/core 13.0.2
@angular-devkit/schematics 13.0.2
@angular/cli 13.0.2
@angular/flex-layout 12.0.0-beta.35
@schematics/angular 13.0.2
rxjs 7.4.0
typescript 4.4.4```
**Anything else relevant?**
<!-- ✍️Is this a browser specific issue? If so, please specify the browser and version. -->
<!-- ✍️Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 33 (10 by maintainers)
@alan-agius4 The issue is not reproducible for us anymore. It has has been stable for more than a month now.
@lalo-mx, I downloaded the project, but I wasn’t able to reproduce the error.
@lalo-mx, would you be able to share a reproduction? Or maybe we can schedule a remote debugging session? Without a reproduction it would be hard to get to the bottom of this.
If you’d like to debug this, @alexander-akait suggest that you can add a breakpoint/console.log here https://github.com/webpack/webpack-sources/blob/main/lib/SizeOnlySource.js#L15 and https://github.com/webpack/webpack/blob/main/lib/Compiler.js#L546.
@alan-agius4 well, it just started happening again. If you’re able to connect on Discord perhaps I can help track it down there. I don’t have any specific repro steps because it seems random.
If you search for
Error: Content and Map of this Source
on the official Angular discord server you’ll be able to find me.Indeed and this seems to be something internal to Webpack especially since this only happens with caching. Overall, I highly doubt that this is caused by the Angular CLI, as mentioned we don’t use
SizeOnlySource
. That being said, without a reproduction it’s hard to tell what is happening.Discord is not the right place to report bugs.