flecks/packages/react/build/flecks.bootstrap.js
2024-01-22 09:38:45 -06:00

30 lines
665 B
JavaScript

const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const plugins = [];
const {
FLECKS_CORE_IS_PRODUCTION,
} = process.env;
if ('true' !== FLECKS_CORE_IS_PRODUCTION) {
plugins.push('react-refresh/babel');
}
exports.dependencies = ['@flecks/web'];
exports.hooks = {
'@flecks/core.babel': () => ({
plugins,
presets: [
'@babel/preset-react',
],
}),
'@flecks/build.config': (target, config, env, argv) => {
const isProduction = 'production' === argv.mode;
if (!isProduction) {
config.plugins.push(new ReactRefreshWebpackPlugin());
}
},
'@flecks/build.extensions': () => ['.jsx'],
};