Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency jiti to ^2.4.1 #4139

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/cases/cli/top-level-await/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/index.js
17 changes: 17 additions & 0 deletions e2e/cases/cli/top-level-await/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { execSync } from 'node:child_process';
import path from 'node:path';
import { globContentJSON } from '@e2e/helper';
import { expect, test } from '@playwright/test';

test('should support top level await for config', async () => {
execSync('npx rsbuild build', {
cwd: __dirname,
});
const outputs = await globContentJSON(path.join(__dirname, 'dist'));
const outputFiles = Object.keys(outputs);

expect(outputFiles.find((item) => item.includes('index.html'))).toBeTruthy();
expect(
outputFiles.find((item) => item.includes('static/js/index.')),
).toBeTruthy();
});
13 changes: 13 additions & 0 deletions e2e/cases/cli/top-level-await/rsbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from '@rsbuild/core';

async function asyncFunction() {
return new Promise((resolve) => setTimeout(resolve));
}

await asyncFunction();

export default defineConfig({
output: {
filenameHash: false,
},
});
9 changes: 9 additions & 0 deletions e2e/cases/cli/top-level-await/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@rsbuild/config/tsconfig",
"compilerOptions": {
"jsx": "react-jsx",
"baseUrl": "./",
"outDir": "./dist"
},
"include": ["src", "*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"dotenv-expand": "11.0.7",
"html-rspack-plugin": "6.0.2",
"http-proxy-middleware": "^2.0.6",
"jiti": "^1.21.6",
"jiti": "^2.4.1",
"launch-editor-middleware": "^2.9.1",
"mrmime": "^2.0.0",
"on-finished": "2.4.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,10 @@ export async function loadConfig({
requireCache: false,
interopDefault: true,
});

configExport = loadConfig(configFilePath) as RsbuildConfigExport;
const exportModule = loadConfig(configFilePath);
configExport = (
exportModule.default ? exportModule.default : exportModule
) as RsbuildConfigExport;
}
} catch (err) {
logger.error(`Failed to load file with jiti: ${color.dim(configFilePath)}`);
Expand Down
50 changes: 41 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.