Skip to content

Compilation Crash: Error: Content and Map of this Source is not available (only size() is supported) #24384

@Kp0c

Description

@Kp0c

Command

build, serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Angular 12

Description

Reopen of #22237

I'm able to reproduce it using Angular 13 and Angular 14.

Minimal Reproduction

  1. Download the attached project (build-issue-angular.zip)
  2. Run npm ci
  3. Run npm start
  4. Wait a few seconds (it makes 2nd small compilation, and a few seconds after the 2nd compilation it throws an error)

If you make another attempt to reproduce inside the same project, then the steps are a bit different:

  1. Remove node_modules
  2. Remove .angular
  3. Run npm ci
  4. Run npm start
  5. Wait a few seconds (it makes 2nd small compilation, and a few seconds after the 2nd compilation it throws an error)

Sometimes it is enough to:

  1. Run npm start
  2. Wait a few seconds (it makes 2nd small compilation, and a few seconds after the 2nd compilation it throws an error)

P.S. "a few seconds after" on my PC is ~6 seconds. I'm not sure if it depends on something or not

I was able to reproduce it 5 times in a row

Also, I noticed that workarounds work totally differently for 2 projects where it is reproducible and what I tried:

  1. Personal on Angular 13 -> you need to delete .angular and run npm start again.
  2. Personal on Angular 14 -> run npm start one more time after the error is enough.
  3. Attached project -> nothing helps

Exception or Error

C:\sample-angular-13\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 (C:\sample-angular-13\node_modules\webpack-sources\lib\SizeOnlySource.js:16:10)
    at SizeOnlySource.buffer (C:\sample-angular-13\node_modules\webpack-sources\lib\SizeOnlySource.js:30:14)
    at _isSourceEqual (C:\sample-angular-13\node_modules\webpack\lib\util\source.js:21:51)
    at isSourceEqual (C:\sample-angular-13\node_modules\webpack\lib\util\source.js:43:17)
    at Compilation.emitAsset (C:\sample-angular-13\node_modules\webpack\lib\Compilation.js:4171:9)
    at C:\sample-angular-13\node_modules\webpack\lib\Compiler.js:548:28
    at C:\sample-angular-13\node_modules\webpack\lib\Compiler.js:1129:17
    at eval (eval at create (C:\sample-angular-13\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.0.3
Node: 16.16.0
Package Manager: npm 9.1.3
OS: win32 x64

Angular: 13.0.2
... animations, common, compiler, compiler-cli, core, elements
... forms, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.3
@angular-devkit/build-angular   13.0.3
@angular-devkit/core            13.0.3
@angular-devkit/schematics      13.0.3
@angular/cli                    13.0.3
@schematics/angular             13.0.3
rxjs                            7.4.0
typescript                      4.4.4

Anything else relevant?

No response

Metadata

Metadata

Assignees

Labels

needs: investigationRequires some digging to determine if action is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions