File tree Expand file tree Collapse file tree 4 files changed +30
-11
lines changed
Expand file tree Collapse file tree 4 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 1- import path from 'node:path' ;
21import { normalizeOptions } from './options' ;
3- import { reactRefreshPath , refreshUtilsPath , runtimePaths } from './paths' ;
2+ import {
3+ reactRefreshPath ,
4+ refreshRuntimeDirPath ,
5+ refreshUtilsPath ,
6+ runtimePaths ,
7+ } from './paths' ;
48import { getAdditionalEntries } from './utils/getAdditionalEntries' ;
59import {
610 type IntegrationType ,
@@ -131,9 +135,8 @@ class ReactRefreshRspackPlugin {
131135 new compiler . webpack . DefinePlugin ( definedModules ) . apply ( compiler ) ;
132136 new compiler . webpack . ProvidePlugin ( providedModules ) . apply ( compiler ) ;
133137
134- const refreshPath = path . dirname ( require . resolve ( 'react-refresh' ) ) ;
135138 compiler . options . resolve . alias = {
136- 'react-refresh' : refreshPath ,
139+ 'react-refresh' : refreshRuntimeDirPath ,
137140 ...compiler . options . resolve . alias ,
138141 } ;
139142
Original file line number Diff line number Diff line change 1+ import path from 'node:path' ;
12import type { RuleSetCondition } from '@rspack/core' ;
23import type { IntegrationType } from './utils/getSocketIntegration' ;
34
@@ -107,8 +108,8 @@ const d = <K extends keyof PluginOptions>(
107108
108109const normalizeOverlay = ( options : PluginOptions [ 'overlay' ] ) => {
109110 const defaultOverlay : OverlayOptions = {
110- entry : require . resolve ( '../client/errorOverlayEntry.js' ) ,
111- module : require . resolve ( '../client/overlay/index.js' ) ,
111+ entry : path . join ( __dirname , '../client/errorOverlayEntry.js' ) ,
112+ module : path . join ( __dirname , '../client/overlay/index.js' ) ,
112113 sockIntegration : 'wds' ,
113114 } ;
114115 if ( ! options ) {
Original file line number Diff line number Diff line change 11import path from 'node:path' ;
22
3- export const reactRefreshPath = require . resolve ( '../client/reactRefresh.js' ) ;
4- export const reactRefreshEntryPath = require . resolve (
3+ export const reactRefreshPath = path . join (
4+ __dirname ,
5+ '../client/reactRefresh.js' ,
6+ ) ;
7+ export const reactRefreshEntryPath = path . join (
8+ __dirname ,
59 '../client/reactRefreshEntry.js' ,
610) ;
7- export const refreshUtilsPath = require . resolve ( '../client/refreshUtils.js' ) ;
11+ export const refreshUtilsPath = path . join (
12+ __dirname ,
13+ '../client/refreshUtils.js' ,
14+ ) ;
815export const refreshRuntimeDirPath = path . dirname (
916 require . resolve ( 'react-refresh' , {
1017 paths : [ reactRefreshPath ] ,
Original file line number Diff line number Diff line change 1+ import path from 'node:path' ;
2+
13export type IntegrationType = 'wds' | 'whm' | ( string & { } ) ;
24
35export function getSocketIntegration ( integrationType : IntegrationType ) {
46 let resolvedSocketIntegration : string ;
57 switch ( integrationType ) {
68 case 'wds' : {
7- resolvedSocketIntegration = require . resolve ( './sockets/WDSSocket' ) ;
9+ resolvedSocketIntegration = path . join (
10+ __dirname ,
11+ './sockets/WDSSocket.js' ,
12+ ) ;
813 break ;
914 }
1015 case 'whm' : {
11- resolvedSocketIntegration = require . resolve ( './sockets/WHMEventSource' ) ;
16+ resolvedSocketIntegration = path . join (
17+ __dirname ,
18+ './sockets/WHMEventSource.js' ,
19+ ) ;
1220 break ;
1321 }
1422 default : {
You can’t perform that action at this time.
0 commit comments