File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
e2e/cases/cli/config-loader Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 11import { execSync } from 'node:child_process' ;
22import path from 'node:path' ;
33import { globContentJSON , rspackOnlyTest } from '@e2e/helper' ;
4- import { expect , test } from '@playwright/test' ;
4+ import { expect } from '@playwright/test' ;
55
66rspackOnlyTest ( 'should use Node.js native loader to load config' , async ( ) => {
7- // TODO: fix this test on Windows
8- if ( process . platform === 'win32' ) {
9- test . skip ( ) ;
10- }
11-
127 execSync ( 'npx rsbuild build --config-loader native' , {
138 cwd : __dirname ,
149 env : {
Original file line number Diff line number Diff line change 11import fs from 'node:fs' ;
22import { createRequire } from 'node:module' ;
33import { dirname , isAbsolute , join } from 'node:path' ;
4+ import { pathToFileURL } from 'node:url' ;
45import type { ChokidarOptions } from '../compiled/chokidar/index.js' ;
56import RspackChain from '../compiled/rspack-chain/index.js' ;
67import {
@@ -472,7 +473,8 @@ export async function loadConfig({
472473
473474 if ( loader === 'native' || / \. (?: j s | m j s | c j s ) $ / . test ( configFilePath ) ) {
474475 try {
475- const exportModule = await import ( `${ configFilePath } ?t=${ Date . now ( ) } ` ) ;
476+ const configFileURL = pathToFileURL ( configFilePath ) . href ;
477+ const exportModule = await import ( `${ configFileURL } ?t=${ Date . now ( ) } ` ) ;
476478 configExport = exportModule . default ? exportModule . default : exportModule ;
477479 } catch ( err ) {
478480 if ( loader === 'native' ) {
You can’t perform that action at this time.
0 commit comments