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
2 changes: 1 addition & 1 deletion packages/node-resolve/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function nodeResolve(opts = {}) {

const importSpecifierList = [importee];

if (importer === undefined && !importee[0].match(/^\.?\.?\//)) {
if (importer === undefined && importee[0] && !importee[0].match(/^\.?\.?\//)) {
// For module graph roots (i.e. when importer is undefined), we
// need to handle 'path fragments` like `foo/bar` that are commonly
// found in rollup config files. If importee doesn't look like a
Expand Down
12 changes: 12 additions & 0 deletions packages/node-resolve/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -743,3 +743,15 @@ test('allow other plugins to take over resolution', async (t) => {
]
});
});

test('error message for invalid entry', async (t) => {
const error = await t.throwsAsync(() =>
rollup({
input: '',
onwarn: failOnWarn(t),
plugins: [nodeResolve()]
})
);

t.is(error.message, `Could not resolve entry module "".`);
});
Loading