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

Cannot read property 'filename' of undefined #5

Closed
casalot opened this issue May 18, 2019 · 1 comment
Closed

Cannot read property 'filename' of undefined #5

casalot opened this issue May 18, 2019 · 1 comment

Comments

@casalot
Copy link

casalot commented May 18, 2019

I have the following index.js file:

import importModules from 'import-modules'

const modules = importModules('./test')

console.log(modules);

export default modules

In the same folder as the index.js file, there is a sub-folder test with multiple .js files.

But, the above code produces the following exception: "Cannot read property 'filename' of undefined"

@casalot
Copy link
Author

casalot commented May 18, 2019

This is the line that throws the error:

const parentFile = module.parent.filename;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant