@nx/rspack
Version:
21 lines (20 loc) • 656 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyReactConfig = applyReactConfig;
function applyReactConfig(options = {}, config = {}) {
if (global.NX_GRAPH_CREATION)
return;
addHotReload(config);
// enable rspack node api
config.node = {
__dirname: true,
__filename: true,
};
}
function addHotReload(config) {
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const isDev = process.env.NODE_ENV === 'development' || config.mode === 'development';
if (isDev) {
config.plugins.push(new ReactRefreshPlugin({ overlay: false }));
}
}