feat: Support .wxtrc config file (#1833)

Co-authored-by: Aaron <aaronklinker1@gmail.com>
This commit is contained in:
Sebastian Landwehr
2025-12-16 23:33:37 +01:00
committed by GitHub
parent 25cc403886
commit 24667861db
2 changed files with 3 additions and 9 deletions
+3 -5
View File
@@ -139,17 +139,15 @@ describe('User Config', () => {
).toBe(true);
});
it('should throw error when config file not exist', async () => {
it('should not throw error when config file not exist', async () => {
const project = new TestProject();
project.addFile(
'src/entrypoints/background.ts',
'entrypoints/background.ts',
`export default defineBackground(
() => console.log('Hello background'),
);`,
);
await expect(
project.build({ configFile: 'foo.config.ts' }),
).rejects.toThrowError(/not found/);
await project.build({ configFile: 'foo.config.ts' });
});
});
-4
View File
@@ -50,11 +50,7 @@ export async function resolveConfig(
configFile: inlineConfig.configFile,
name: 'wxt',
cwd: inlineConfig.root ?? process.cwd(),
rcFile: false,
});
if (inlineConfig.configFile && metadata.layers?.length === 0) {
throw Error(`Config file "${inlineConfig.configFile}" not found`);
}
userConfig = loadedConfig ?? {};
userConfigMetadata = metadata;
}