reflect-metadata icon indicating copy to clipboard operation
reflect-metadata copied to clipboard

Reflect-Metadata doesn't work with WebPack 3 Scope Hoisting

Open CmdrShepardsPie opened this issue 6 years ago • 1 comments

I tried reporting this to the WebPack team and they said it is a problem with Reflect-Metadata.

I'm using Reflect-Metadata in a TypeScript project that's being built and bundled with WebPack 3. When I add the scope hoisting plugin to my WebPack config, the project no longer runs properly.

I get the following error: Uncaught TypeError: Reflect.hasOwnMetadata is not a function at injectable.js:7 at Object.__decorate [as a] (tslib.es6.js:48) at Object../client/app/app.bootstrap.ts (data.service.ts:4) at webpack_require (bootstrap 1856459e76a82a034076:54) at webpackJsonpCallback (bootstrap 1856459e76a82a034076:25) at app.js:1 (anonymous) @ injectable.js:7 __decorate @ tslib.es6.js:48 ./client/app/app.bootstrap.ts @ data.service.ts:4 webpack_require @ bootstrap 1856459e76a82a034076:54 webpackJsonpCallback @ bootstrap 1856459e76a82a034076:25 (anonymous) @ app.js:1

Is there a way to make it work, or can this problem be fixed?

CmdrShepardsPie avatar Aug 02 '17 16:08 CmdrShepardsPie

Seems totally busted in webpack 4. In my limited debugging it looks like reflect-metadata is not getting included in the resulting bundle at all.

Edit: Or maybe it is? I tried to use webpack shims, but that didn't get it going either, I may have been using it wrong however.

Edit2: I think I was doing something wrong, I re-did the update on our app and things are fine 🤔

danzel avatar Mar 02 '18 02:03 danzel