mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-13 03:22:56 +00:00
[change] Remove inline requires
Replace CJS inline requires with top-level imports that will be removed via DCE in production bundles. Close #1895
This commit is contained in:
committed by
Nicolas Gallagher
parent
4b8cd20aaa
commit
12532f67f2
@@ -9,6 +9,7 @@
|
||||
|
||||
import ReactNativePropRegistry from './ReactNativePropRegistry';
|
||||
import flattenStyle from './flattenStyle';
|
||||
import validate from './validate';
|
||||
|
||||
const absoluteFillObject = {
|
||||
position: 'absolute',
|
||||
@@ -47,9 +48,7 @@ const StyleSheet = {
|
||||
const result = {};
|
||||
Object.keys(styles).forEach(key => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const validate = require('./validate');
|
||||
const interopValidate = validate.default ? validate.default : validate;
|
||||
interopValidate(key, styles);
|
||||
validate(key, styles);
|
||||
}
|
||||
const id = styles[key] && ReactNativePropRegistry.register(styles[key]);
|
||||
result[key] = id;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import EventEmitter from './EventEmitter';
|
||||
import EventEmitterWithHolding from './EventEmitterWithHolding';
|
||||
import EventHolder from './EventHolder';
|
||||
import EventValidator from './EventValidator';
|
||||
|
||||
import invariant from 'fbjs/lib/invariant';
|
||||
import keyOf from 'fbjs/lib/keyOf';
|
||||
@@ -121,7 +122,6 @@ const EventEmitterMixin = {
|
||||
if (!this.__eventEmitter) {
|
||||
let emitter = new EventEmitter();
|
||||
if (__DEV__) {
|
||||
const EventValidator = require('./EventValidator').default;
|
||||
emitter = EventValidator.addValidation(emitter, this.__types);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user