Skip to content
Merged
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
6 changes: 5 additions & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,11 @@ const composeEntryConfig = async (
});

if (resolvedEntryFiles.length === 0) {
throw new Error(`Cannot find ${resolvedEntryFiles}`);
const error = new Error(
`No entry files matching ${entryFiles.map((file) => color.cyan(file)).join(', ')}. Please ensure the entry pattern in ${color.cyan('source.entry')} is correct and points to valid source files.`,
);
error.stack = '';
throw error;
}

const outBase = await resolveOutBase(resolvedEntryFiles);
Expand Down
15 changes: 14 additions & 1 deletion tests/integration/entry/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ test('validate entry and throw errors', async () => {
try {
await buildAndGetResults({
fixturePath,
configPath: 'nonExistingFile.config.ts',
configPath: 'bundleNonExistingFile.config.ts',
});
} catch (e) {
errMsg = (e as AggregateError).errors.join('\n\n');
Expand All @@ -192,6 +192,19 @@ test('validate entry and throw errors', async () => {
`"Error: Can't resolve the entry "./src/main.ts" at the location <ROOT>/tests/integration/entry/validate/src/main.ts. Please ensure that the file exists."`,
);

try {
await buildAndGetResults({
fixturePath,
configPath: 'bundlelessNonExistingFile.config.ts',
});
} catch (e) {
errMsg = (e as Error).message;
}

expect(stripAnsi(errMsg)).toMatchInlineSnapshot(
`"No entry files matching ./src/non-existing-file.ts, ./non-existing-folder/**/*. Please ensure the entry pattern in source.entry is correct and points to valid source files."`,
);

try {
await buildAndGetResults({
fixturePath,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from '@rslib/core';
import { generateBundleEsmConfig } from 'test-helper';

export default defineConfig({
lib: [
generateBundleEsmConfig({
bundle: false,
source: {
entry: {
index: ['./src/non-existing-file.ts', './non-existing-folder/**/*'],
},
},
}),
],
});
Loading