Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyReactConfig = applyReactConfig;
function applyReactConfig(options = {}, config = {}) {
if (!process.env['NX_TASK_TARGET_PROJECT'])
return;
addHotReload(config);
// enable webpack node api
config.node = {
__dirname: true,
__filename: true,
};
}
function addHotReload(config) {
if (config.mode === 'development' &&
typeof config['devServer'] === 'object' &&
config['devServer']?.hot) {
// add `react-refresh/babel` to babel loader plugin
const babelLoader = config.module.rules.find((rule) => rule &&
typeof rule !== 'string' &&
rule.loader?.toString().includes('babel-loader'));
if (babelLoader && typeof babelLoader !== 'string') {
babelLoader.options['plugins'] = [
...(babelLoader.options['plugins'] || []),
[
require.resolve('react-refresh/babel'),
{
skipEnvCheck: true,
},
],
];
}
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
config.plugins.push(new ReactRefreshPlugin({ overlay: false }));
}
}