Repository navigation
Normalize main property - #220
Conversation
|
Question: does {
"main": "test"
}and you have |
|
@rauchg hmm, I believe you are correct. I'll revise soon. |
b78c4bf to
e31b9ea
Compare
|
@rauchg so, I've got another version here, but there's a complication with using
At the moment I've opted for the second option which is in the current commit. If you would still prefer to glob and stat separately from the other files as a special case as in the first option, let me know and I will make the change. Thanks! |
e31b9ea to
61ad112
Compare
|
You can use require.resolve('./src/scripts/app')
//=> '/Users/.../src/scripts/app.js'
require.resolve('./src/scripts/views')
//=> '/Users/.../src/scripts/views/index.js' |
|
@lukeed great idea! |
|
I think the const search = Array.prototype.concat
.apply([], (await Promise.all(search_
.map(file => glob(file, {cwd: path, absolute: true, dot: true})))))
if (pkg.main) {
search.push(require.resolve(resolve(path, pkg.main)));
}Essentially, resolving the file path of |
61ad112 to
d9cd276
Compare
d9cd276 to
d942cd4
Compare
main property
This should ensure that a package.json main entry with or without the
.jsextension should still be found by the filesystem.Fixes #2