microsoft / microsoft/reflect-metadata

shim is required Error

Open
#74 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.4k
Forks
190
Avg merge
13h 52m
Merged PRs (30d)
1

Description

Hey out there,

we are totally stuck by a recently occuring error.

We use reflect-metadata 0.1.10 in our angular-starter project. We also use Angular 4.2.5 and Typescript 4.2.1

We switched our whole building system days ago and can not figure out, why this error occurs.

Uncaught reflect-metadata shim is required when using class decorators
DecoratorFactory @ main.5882b9f….bundle.js:1
(anonymous) @ main.5882b9f….bundle.js:1
YWx4 @ main.5882b9f….bundle.js:1
__webpack_require__ @ main.5882b9f….bundle.js:1
Iksp @ main.5882b9f….bundle.js:1
__webpack_require__ @ main.5882b9f….bundle.js:1
7G6f @ main.5882b9f….bundle.js:1
__webpack_require__ @ main.5882b9f….bundle.js:1
fYOR @ main.5882b9f….bundle.js:1
__webpack_require__ @ main.5882b9f….bundle.js:1
+1L/ @ main.5882b9f….bundle.js:1
(anonymous) @ main.5882b9f….bundle.js:1

Our polyfills file looks good, I guess:

import 'core-js/es6/array';
import 'core-js/es6/date';
import 'core-js/es6/function';
import 'core-js/es6/map';
import 'core-js/es6/math';
import 'core-js/es6/number';
import 'core-js/es6/object';
import 'core-js/es6/parse-float';
import 'core-js/es6/parse-int';
import 'core-js/es6/reflect';
import 'core-js/es6/regexp';
import 'core-js/es6/set';
import 'core-js/es6/string';
import 'core-js/es6/symbol';
import 'core-js/es6/typed';
import 'core-js/es6/weak-map';
import 'core-js/es6/weak-set';
import 'core-js/es7/reflect';
import 'reflect-metadata';
import 'zone.js/dist/zone';
if ('production' !== ENV) {
    Error.stackTraceLimit = Infinity;
    require('zone.js/dist/long-stack-trace-zone');
}

The error occurs, when we act as a "normal" user and UNCHECK "disable cache" in our devTools. When we switch routes the error occurs. When we CHECK "disable cache" there seems to be no problem.

Any guesses? We appreciate your help. Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown polyfills file and reproduce the route switch with browser cache enabled and disabled. Trace why the reflect-metadata shim is unavailable in one case; done means identifying the cause and documenting a verified resolution or reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.