Webpack: only load react-refresh/babel in development
This commit is contained in:
parent
2ddd3ef2ac
commit
e1e70c6715
1 changed files with 3 additions and 3 deletions
|
@ -4,6 +4,8 @@ import { env, settings } from '../configuration';
|
||||||
|
|
||||||
import type { RuleSetRule } from 'webpack';
|
import type { RuleSetRule } from 'webpack';
|
||||||
|
|
||||||
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
const rule: RuleSetRule = {
|
const rule: RuleSetRule = {
|
||||||
test: /\.(js|jsx|mjs|ts|tsx)$/,
|
test: /\.(js|jsx|mjs|ts|tsx)$/,
|
||||||
include: [
|
include: [
|
||||||
|
@ -25,9 +27,7 @@ const rule: RuleSetRule = {
|
||||||
cacheDirectory: join(settings.cache_path, 'babel-loader'),
|
cacheDirectory: join(settings.cache_path, 'babel-loader'),
|
||||||
cacheCompression: env.NODE_ENV === 'production',
|
cacheCompression: env.NODE_ENV === 'production',
|
||||||
compact: env.NODE_ENV === 'production',
|
compact: env.NODE_ENV === 'production',
|
||||||
plugins: [
|
plugins: isDevelopment ? ['react-refresh/babel'] : [],
|
||||||
'react-refresh/babel',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue