File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
packages/plugin-react-swc/src Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change 11import { readFileSync } from 'node:fs'
2- import { dirname , join } from 'node:path'
3- import { fileURLToPath } from 'node:url'
2+ import { join } from 'node:path'
43import { createRequire } from 'node:module'
54import {
65 type JscTarget ,
@@ -21,15 +20,7 @@ import {
2120import * as vite from 'vite'
2221import { exactRegex } from '@rolldown/pluginutils'
2322
24- /* eslint-disable no-restricted-globals */
25- const _dirname =
26- typeof __dirname !== 'undefined'
27- ? __dirname
28- : dirname ( fileURLToPath ( import . meta. url ) )
29- const resolve = createRequire (
30- typeof __filename !== 'undefined' ? __filename : import . meta. url ,
31- ) . resolve
32- /* eslint-enable no-restricted-globals */
23+ const resolve = createRequire ( import . meta. url ) . resolve
3324
3425type Options = {
3526 /**
@@ -114,7 +105,8 @@ const react = (_options?: Options): Plugin[] => {
114105 handler : ( id ) =>
115106 id === runtimePublicPath
116107 ? readFileSync (
117- join ( _dirname , 'refresh-runtime.js' ) ,
108+ // eslint-disable-next-line n/no-unsupported-features/node-builtins -- import.meta.dirname is stable in the newer versions and the API has not changed
109+ join ( import . meta. dirname , 'refresh-runtime.js' ) ,
118110 'utf-8' ,
119111 ) . replace (
120112 / _ _ R E A D M E _ U R L _ _ / g,
You can’t perform that action at this time.
0 commit comments