create-create-app
create-create-app copied to clipboard
Cannot read property 'filename' of undefined
Hi, I'm using v7.3.0, and encountering an error "Cannot read property 'filename' of undefined" - it looks like it's related to the epicfail check for 'require.main!.filename' in the create function. The Node docs say that when the entry point is not a CommonJS module, require.main is undefined -- and the entry point of my app is a module, not cjs.
Is there any way around this issue?
I went back to v7.1.0 and everything works. But there's been some nice additions since then, and I'd love to use the latest version.
Thanks!
This might be relevant? https://github.com/blueconic/node-oom-heapdump/issues/3#issuecomment-360537384
... checking if require.main is null and if so, use process.cwd (https://nodejs.org/api/process.html#process_process_cwd)? Or just use https://www.npmjs.com/package/require-main-filename?
Should the value be passed into the create
function from cli.js
rather than commonJS being presumed?
Then, developers can choose to pass either require.main.filename
or import.meta.url
depending on whether they are using commonJS or ES modules.