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

Missing exports errors now print the importing module #3401

Merged
merged 4 commits into from Mar 6, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Module.ts
Expand Up @@ -157,7 +157,9 @@ function handleMissingExport(
return importingModule.error(
{
code: 'MISSING_EXPORT',
message: `'${exportName}' is not exported by ${relativeId(importedModule)}`,
message: `'${exportName}' is not exported by ${relativeId(
importedModule
)}, imported by ${relativeId(importingModule.id)}`,
url: `https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module`
},
importerStart!
Expand Down
Expand Up @@ -16,7 +16,7 @@ module.exports = {
file: path.resolve(__dirname, 'dep2.js'),
line: 1
},
message: "'doesNotExist' is not exported by dep1.js",
message: "'doesNotExist' is not exported by dep1.js, imported by dep2.js",
pos: 9,
url: 'https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module',
watchFiles: [
Expand Down
2 changes: 1 addition & 1 deletion test/function/samples/default-not-reexported/_config.js
Expand Up @@ -4,7 +4,7 @@ module.exports = {
description: 'default export is not re-exported with export *',
error: {
code: 'MISSING_EXPORT',
message: `'default' is not exported by foo.js`,
message: `'default' is not exported by foo.js, imported by main.js`,
pos: 7,
watchFiles: [
path.resolve(__dirname, 'main.js'),
Expand Down
Expand Up @@ -20,7 +20,7 @@ module.exports = {
},
error: {
code: 'MISSING_EXPORT',
message: `'default' is not exported by empty.js`,
message: `'default' is not exported by empty.js, imported by main.js`,
pos: 44,
watchFiles: [path.resolve(__dirname, 'main.js'), path.resolve(__dirname, 'empty.js')],
loc: {
Expand Down
Expand Up @@ -4,7 +4,7 @@ module.exports = {
description: 'marking an imported, but unexported, identifier should throw',
error: {
code: 'MISSING_EXPORT',
message: `'default' is not exported by empty.js`,
message: `'default' is not exported by empty.js, imported by main.js`,
pos: 7,
watchFiles: [path.resolve(__dirname, 'main.js'), path.resolve(__dirname, 'empty.js')],
loc: {
Expand Down
2 changes: 1 addition & 1 deletion test/function/samples/reexport-missing-error/_config.js
Expand Up @@ -4,7 +4,7 @@ module.exports = {
description: 'reexporting a missing identifier should print an error',
error: {
code: 'MISSING_EXPORT',
message: `'foo' is not exported by empty.js`,
message: `'foo' is not exported by empty.js, imported by main.js`,
pos: 9,
watchFiles: [path.resolve(__dirname, 'main.js'), path.resolve(__dirname, 'empty.js')],
loc: {
Expand Down