Hi there ๐
Follow me on twitter @PatrickJS__
Webpack and Universal support for reflect-metadata refactored by @gdi2290
License: Apache License 2.0
Follow me on twitter @PatrickJS__
Hi - as title.
I have created a class decorator that defines if the class (which is a react screen) should show up in the main menu, and at what order etc.
I have the menu doing the reflection, and do not want to create instances of the screens to pass in. passing types fails..
Additionally, (and probably warrants its own separate thread), I dont like the pattern of explicity passing types/objects to my renderer component, and want that component instead to be able to scan for all classes that implement that metadata, but it doesnt seem possible without grouping all the possible classes into one file wrapped in a module directive.
I'm getting two errors in my browser console (Chrome latest). See end of message for call stacks.
My webpack build succedes, but the browser won't finish loading the page due to the errors. My package.json specifies:
"es7-reflect-metadata": "^1.5.5",
Uncaught TypeError: crypto.randomBytes is not a functiongenRandomBytes @ gen-randombytes.ts:5createUUID @ create-uuid.ts:5createUniqueKey @ create-unique-key.ts:11(anonymous function) @ weakmap.ts:5__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ metadata.ts:1__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ reflect-metadata.ts:22__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ browser.ts:1__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ polyfills.ts:18__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ bootstrap ce8ea336ef6e370d804f:93(anonymous function) @ bootstrap ce8ea336ef6e370d804f:93 decorators.ts:242Uncaught reflect-metadata shim is required when using class decorators(anonymous function) @ decorators.ts:242__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ decorators.ts:9__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:18__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:2__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ metadata.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ core.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ main.ts:4__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50webpackJsonpCallback @ bootstrap ce8ea336ef6e370d804f:21(anonymous function) @ main.bundle.js:1
And
Uncaught reflect-metadata shim is required when using class decorators(anonymous function) @ decorators.ts:242__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ decorators.ts:9__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:18__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ di.ts:2__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ metadata.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ core.ts:6__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50(anonymous function) @ main.ts:4__webpack_require__ @ bootstrap ce8ea336ef6e370d804f:50webpackJsonpCallback @ bootstrap ce8ea336ef6e370d804f:21(anonymous function) @ main.bundle.js:1
Thanks to help the community.
I succesfully applied meta data using Reflect.defineMetadata... but when i go declarative way i get errors. I think i did not understand the tutorial well please help
import "./reflect-metadata";
export class Address {
@Reflect.metadata("Obsolete","true") <-- this throws error
method() {
}
}
package.json still has reference to dist/index.js and 1.2.0 version doesn't work properly if install via npm.
I have a question. I couldn't understand what the name, es7-reflect-metadata
, means.
Draft of ES7 (should be called as ES2016) has been snapshotted already. ReflectMetadata never be included by ES7.
https://twitter.com/bterlson/status/692424625813377026
I think this package is just a fork of reflect-metadata
package for supporting UMD and Webpack. Why did you name this es7-reflect-metadata
?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.