Skip to content

Commit e44d808

Browse files
committed
clean-up rollup.config.js
1 parent 9c2bd37 commit e44d808

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

rollup.config.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ const CORE_PLUGINS = [
7171
babelPlugin,
7272
];
7373

74+
const browserEnvPlugins = env => {
75+
return [
76+
replace({ 'process.env.NODE_ENV': JSON.stringify(env) }),
77+
modifyReplacePlugin,
78+
terser(),
79+
];
80+
};
81+
7482
export default [
7583
/*** COMMONJS ***/
7684
{
@@ -104,14 +112,7 @@ export default [
104112
globals,
105113
name,
106114
},
107-
plugins: [
108-
...CORE_PLUGINS,
109-
replace({
110-
'process.env.NODE_ENV': JSON.stringify('development'),
111-
}),
112-
modifyReplacePlugin,
113-
terser(),
114-
],
115+
plugins: [...CORE_PLUGINS, ...browserEnvPlugins('development')],
115116
},
116117

117118
/*** BROWSER (PRODUCTION) ***/
@@ -124,13 +125,6 @@ export default [
124125
globals,
125126
name,
126127
},
127-
plugins: [
128-
...CORE_PLUGINS,
129-
replace({
130-
'process.env.NODE_ENV': JSON.stringify('production'),
131-
}),
132-
modifyReplacePlugin,
133-
terser(),
134-
],
128+
plugins: [...CORE_PLUGINS, ...browserEnvPlugins('production')],
135129
},
136130
];

0 commit comments

Comments
 (0)