Animations cause "ReferenceError: Can't find variable: _angular_common__WEBPACK_IMPORTED_MODULE_1__"

This issue has been created since 2022-11-19.

Which @angular/* package(s) are the source of the bug?

animations

Is this a regression?

Yes

Description

Hey folks,

I've tried to update my application to the new version 15 and it suddenly stopped working on my iPhone.
After debugging for a while I figured out that the issue was caused by the animations used.

I've created a minimal reproduction example on StackBlitz, but unfortunately the issue can not be seen in the preview editor of StackBlitz. It seems that the editor influences the execution of the app. To create a local reproduction example you can simply create a new project via ng new and add an animation to the app.component.ts.

animations: [
  trigger('example', [
    state('void', style({ opacity: 1 })),

    transition(':enter', [
      style({
        opacity: 0,
      }),
      animate('750ms 100ms ease-out'),
    ]),

    transition(':leave', [
      animate('250ms ease-in', style({
        opacity: 0,
      })),
    ]),
  ]),
],

The content of the animation doesn't really matter, the issue occurs with every animation I tried

The issue is really confusing.
As soon as I open the DevTools (via Remote-Debugging) while the application boots the issue no longer occurs.
But if I open the DevTools after the app crashed, I can see the error, which I added in "Please provide the exception or error you saw".

This is the code from main.js:352:

[...]
dependencies: [
  _angular_common__WEBPACK_IMPORTED_MODULE_1__.NgSwitch,
  _angular_common__WEBPACK_IMPORTED_MODULE_1__.NgSwitchCase,
  _angular_common__WEBPACK_IMPORTED_MODULE_1__.NgSwitchDefault
],
styles: [...]

So far I was only able to reproduce the error on my iPhone 7 (Safari), currently running iOS 15.7.1.
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 15_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.3 Mobile/15E148 Safari/604.1

In Safari on MacOS or iPadOS it works without any issues.
Server-Side-Rendering with Universal is also uneffected.

I don't know if that helps but in my main application the error which initially crashed my app was this (also main.js):
ReferenceError: Can't find variable: _c3

const _c3 = ['*']
[...]
class ImageComponent {
  [...]
  static #_2 = this.ɵcmp = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_6__['ɵɵdefineComponent']({
    type: ImageComponent,
    [...]
    ngContentSelectors: _c3,
    decls: 7,
    [...]
  })
[...]

Let me know if I can assist with more information or debugging regarding this issue!

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ivy-n7ay9w?file=package.json,src%2Fapp%2Fapp.module.ts,src%2Fapp%2Fapp.component.ts

Please provide the exception or error you saw

[Error] ReferenceError: Can't find variable: _angular_common__WEBPACK_IMPORTED_MODULE_1__
	(anonyme Funktion) (main.js:352)
	(anonyme Funktion) (main.js:62)
	__webpack_require__ (runtime.js:23)
	(anonyme Funktion) (main.js:383:92)
	__webpack_require__ (runtime.js:23)
	(anonyme Funktion) (main.js:417:93)
	__webpack_require__ (runtime.js:23)
	(anonyme Funktion) (runtime.js:57)
	(anonyme Funktion) (main.js:428)
	webpackJsonpCallback (runtime.js:145)
	webpackJsonpCallback
	Modulcode (main.js:2)
	evaluate
	moduleEvaluation
	(anonyme Funktion)
	promiseReactionJob

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.0.0
Node: 16.18.1
Package Manager: npm 8.19.2
OS: darwin x64

Angular: 15.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.0
@angular-devkit/build-angular   15.0.0
@angular-devkit/core            15.0.0
@angular-devkit/schematics      15.0.0
@schematics/angular             15.0.0
rxjs                            7.5.7
typescript                      4.8.4

Anything else?

No response

More Details About Repo
Owner Name angular
Repo Name angular
Full Name angular/angular
Language TypeScript
Created Date 2014-09-18
Updated Date 2022-12-01
Star Count 85220
Watcher Count 3042
Fork Count 22607
Issue Count 1316

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
[BUG] 数据库输入错误后,若启动自动登录则无法退出 1 2022-05-21 2022-09-21
Open discussion about cart remplacement when you login 1 2021-08-18 2022-11-04
job-manager: add limit on maximum number of active jobs per user 3 2022-07-26 2022-08-12
system instance reliability/administration 0 2022-07-25 2022-08-12
Issue with import_oms_pbf WPS block on bigger city area 2 2021-04-10 2022-10-21
Use Microsoft.Extensions.Logging (ILogger) when printing out the messages 0 2021-10-25 2022-11-16
sidebar overflow when having lots of apps 2 2021-08-22 2022-11-13
[Adjust Rule] SIM110 3 2021-01-29 2022-11-04
Allow providing whitelist of files to check 4 2021-09-13 2022-11-02
Allow using "scan" operator 0 2021-04-28 2022-11-18
Cannot run the file even after chmod +x uad_gui-linux 2 2022-02-02 2022-10-30
Functions copied from one instance of GDevelop to another keep the source extension prefix in their instructions. 5 2022-01-31 2022-11-02
Disable transactions 2 2022-10-19 2022-11-18
Mouse spamming wheel events causing input queue to never catch up (was: Can I make imgui consume all the input events when ImGuiIO::ConfigInputTrickleEventQueue is on?) 11 2022-08-05 2022-11-02
libselinux: bad separation between public and provate API/ABI 5 2019-12-10 2022-10-31
RepeatMasker Failing to Find Simple Repeats 2 2021-11-19 2022-11-27
macros running twice 2 2021-04-26 2022-09-03
[Docs Feedback]: How can I develop VS Code extensions? 0 2021-11-04 2022-10-20
namespace option doesn't work with babel-plugin-macros 1 2021-03-10 2022-11-12
Updated version on Windows 5 2022-05-28 2022-08-21
Configurable shared executor service for com.rabbitmq.client.impl.ConsumerWorkService 1 2022-02-18 2022-11-21
java.lang.NoClassDefFoundError: kotlin/jvm/JvmInline 12 2021-12-01 2022-11-15
Missing backup for existing files 3 2021-01-22 2022-11-24
Why the data farmats of trace stdout exporter in different language are not uniform 1 2022-01-13 2022-10-17
A new release please 4 2021-05-08 2022-11-18
"floating" jitsi window is too small to display all buttons 3 2020-10-05 2022-11-19
Command responses don't get posted in the RHS 4 2020-10-03 2022-11-29
Desktop E2E Test: MM-T4385 Select Tab from Menu 5 2021-11-25 2022-11-03
Ensure "push" permission is integrated into Push API spec 0 2021-10-12 2022-11-21
Proposals: Drop "Powerful features registry" and PermissionName enum 6 2021-11-04 2022-11-21
Missing questions in Microsoft Powerpoint 0 2022-07-29 2022-11-30
Compatible with `@vitejs/plugin-react` 2 2021-10-20 2022-11-18
Global TopicAttributes not being applied 11 2021-10-18 2022-09-27
Add a testing framework to the vm 4 2022-01-27 2022-10-05
Progress & metadata goes to stderr instead of stdout 1 2020-07-31 2022-11-18
getNode() throws status=Bad_NodeClassInvalid (not seems ok in other clients) 5 2021-02-11 2022-11-19
server function: esbuild Parse Error when running from tsx 3 2022-08-24 2022-11-03
ERROR: StackOverflowError: 0 2022-08-03 2022-11-20
"silence is not valid" on webui when using regex 4 2021-08-05 2022-11-02
[APIView Python] incorrectly marking async paging as `async def` 1 2021-08-23 2022-11-18
Possibility of using TPM to emulate T2? 1 2021-09-24 2022-11-30
Stubgen doesn't look at C type's docstring when inferring __init__'s type 0 2022-11-19 2022-11-23
The sdist is missing tox.ini 0 2022-11-19 2022-11-23
StandardTestDispatcher runs pending tasks immediately (also regardless of delay) 9 2022-04-07 2022-11-22
400 ERR_BAD_REQUEST while fetching resting heart rate 0 2022-11-16 2022-12-01
[Feature] Add new docker image for Ubuntu 22.04 Jammy Jellyfish LTS 1 2022-05-10 2022-11-12
URI.escape is obsolete warnings 1 2020-05-11 2022-11-10
How to get VoxCeleb data 4 2019-01-04 2022-11-26
GUI: Change position of the search bar 0 2021-06-22 2022-07-21
Frame drop when scrolling map by calling [projection pointForCoordinate:] in didChangeCameraPosition: delegate method 1 2022-02-12 2022-11-23