andreychernykh / bug-reproduce-1 Goto Github PK
View Code? Open in Web Editor NEWReproduce case for the bug in the `metro-babel7-plugin-react-transform`
License: MIT License
Reproduce case for the bug in the `metro-babel7-plugin-react-transform`
License: MIT License
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Class properties, defined as ClassName.propertyName = ....
are undefined
class User extends React.Component {
render() {
console.log(User.propTypes) // undefined
console.log(User.myStaticProperty) // undefined
}
}
User.propTypes = {};
User.myStaticProperty = '42';
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
What is the expected behavior?
class User extends React.Component {
render() {
console.log(User.propTypes) // {}
console.log(User.myStaticProperty) // '42'
}
}
User.propTypes = {};
User.myStaticProperty = '42';
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
// package.json:
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"metro-babel7-plugin-react-transform": "^0.52.0",
// babel.config.js
module.exports = {
presets: ['@babel/env', '@babel/react'],
plugins: ['@babel/proposal-class-properties'],
env: {
development: {
plugins: [
[
'module:metro-babel7-plugin-react-transform',
{
transforms: [{
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module'],
}],
},
],
],
},
},
};
node: 10.15.1
yarn: 1.13.0
It looks like some changes were made in this method: https://github.com/facebook/metro/blob/08f41b7d3d937738492d17f4a92e135d4c1134fa/packages/metro-babel7-plugin-react-transform/src/index.js#L151
We believe, that might be a cause of this bug.
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.