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';
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV === 'development';
|
||||
|
||||
const rule: RuleSetRule = {
|
||||
test: /\.(js|jsx|mjs|ts|tsx)$/,
|
||||
include: [
|
||||
|
@ -25,9 +27,7 @@ const rule: RuleSetRule = {
|
|||
cacheDirectory: join(settings.cache_path, 'babel-loader'),
|
||||
cacheCompression: env.NODE_ENV === 'production',
|
||||
compact: env.NODE_ENV === 'production',
|
||||
plugins: [
|
||||
'react-refresh/babel',
|
||||
],
|
||||
plugins: isDevelopment ? ['react-refresh/babel'] : [],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue