refactor(rollup): use replace plugin before other plugins
This commit is contained in:
+5
-4
@@ -36,6 +36,10 @@ export default [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
replace({
|
||||||
|
__ENV__: JSON.stringify(processEnv),
|
||||||
|
__REACT_FLOW_VERSION__: JSON.stringify(pkg.version),
|
||||||
|
}),
|
||||||
bundleSize(),
|
bundleSize(),
|
||||||
postcss({
|
postcss({
|
||||||
minimize: isProd,
|
minimize: isProd,
|
||||||
@@ -44,10 +48,7 @@ export default [
|
|||||||
exclude: 'node_modules/**',
|
exclude: 'node_modules/**',
|
||||||
babelHelpers: 'runtime',
|
babelHelpers: 'runtime',
|
||||||
}),
|
}),
|
||||||
replace({
|
|
||||||
__ENV__: JSON.stringify(processEnv),
|
|
||||||
__REACT_FLOW_VERSION__: JSON.stringify(pkg.version),
|
|
||||||
}),
|
|
||||||
svgr(),
|
svgr(),
|
||||||
typescript({
|
typescript({
|
||||||
clean: true,
|
clean: true,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useMemo, CSSProperties, HTMLAttributes, MouseEvent, WheelEvent } from 'react';
|
import React, { useMemo, CSSProperties, HTMLAttributes, MouseEvent, WheelEvent } from 'react';
|
||||||
import cc from 'classcat';
|
import cc from 'classcat';
|
||||||
|
|
||||||
const nodeEnv: string = __ENV__ as string;
|
const nodeEnv: string = (typeof __ENV__ !== 'undefined' && __ENV__) as string;
|
||||||
|
|
||||||
if (nodeEnv !== 'production') {
|
if (nodeEnv !== 'production') {
|
||||||
const whyDidYouRender = require('@welldone-software/why-did-you-render');
|
const whyDidYouRender = require('@welldone-software/why-did-you-render');
|
||||||
|
|||||||
+1
-1
@@ -511,7 +511,7 @@ export const storeModel: StoreModel = {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
const nodeEnv: string = __ENV__ as string;
|
const nodeEnv: string = (typeof __ENV__ !== 'undefined' && __ENV__) as string;
|
||||||
const store = createStore(storeModel, { devTools: nodeEnv === 'development' });
|
const store = createStore(storeModel, { devTools: nodeEnv === 'development' });
|
||||||
|
|
||||||
export default store;
|
export default store;
|
||||||
|
|||||||
Reference in New Issue
Block a user