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,3 @@
import { Configuration, WebpackOptionsNormalized } from 'webpack';
export declare function applyReactConfig(options?: Record<string, any>, config?: Partial<WebpackOptionsNormalized | Configuration>): void;
//# sourceMappingURL=apply-react-config.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"apply-react-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/plugins/nx-react-webpack-plugin/lib/apply-react-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAElE,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,MAAM,GAAE,OAAO,CAAC,wBAAwB,GAAG,aAAa,CAAM,GAC7D,IAAI,CAUN"}

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 }));
}
}

View File

@@ -0,0 +1,7 @@
import { Compiler } from 'webpack';
export declare class NxReactWebpackPlugin {
private options;
constructor(options?: Record<string, any>);
apply(compiler: Compiler): void;
}
//# sourceMappingURL=nx-react-webpack-plugin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"nx-react-webpack-plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/react/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,qBAAa,oBAAoB;IACnB,OAAO,CAAC,OAAO;gBAAP,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAErD,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAGhC"}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NxReactWebpackPlugin = void 0;
const apply_react_config_1 = require("./lib/apply-react-config");
class NxReactWebpackPlugin {
constructor(options = {}) {
this.options = options;
}
apply(compiler) {
(0, apply_react_config_1.applyReactConfig)(this.options, compiler.options);
}
}
exports.NxReactWebpackPlugin = NxReactWebpackPlugin;