-
-
Notifications
You must be signed in to change notification settings - Fork 238
Conversation
Seems like a legit fix to me, let's figure out what's wrong with tests, we need to make them pass |
linking: #795 |
So this fix doesn't work.. It works in the context of " |
well it should be here fuse-box/src/core/PathMaster.ts Lines 233 to 246 in 91b4c47
That's for sure, and has to return alias: fuse-box/src/core/PathMaster.ts Lines 296 to 299 in 91b4c47
Actually, alias should come here: fuse-box/src/core/PathMaster.ts Lines 311 to 313 in 91b4c47
|
I'm out for the night. I think I've fixed the issue. Please review! |
@@ -326,12 +326,8 @@ gulp.task("installDevDeps", function(done) { | |||
"buble", | |||
]; | |||
|
|||
if (os.platform().match(/^win/)) { | |||
let windowsCommands = ["start", "cmd.exe", "/K", "npm", "install", "--no-save", ...deps]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you remove that one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced it with spawn('npm.cmd', ...)
on windows
This avoids a shell popping up, that has to be closed manually before the task will finish
src/loader/LoaderAPI.ts
Outdated
validPath = $pathJoin(filePath, "/", "index.js"); | ||
file = pkg.f[validPath]; | ||
|
||
if (!file && pkg.s && pkg.s.entry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's that? Why did you modify the loader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the path is fully relative it will land here. See:
https://github.com/calebboyd/fuse-test
If its not the index it must be an entry file. Specifically, a fully relative name.
'..'
or '../../'
. As a guard an isRelative
check could be made..
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what if there a package.json with a different entry? that's why we had that alias
thingy in PathMaster, that overrides it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have an idea of what alias
needs to be set to, any tips would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell providing an alias does nothing -- The property is set but then it is never used again...
Is that correct?
fuse-box/src/core/PathMaster.ts
Lines 153 to 155 in 813bc79
if (absPath.alias) { | |
data.fuseBoxAlias = absPath.alias; | |
} |
fb01ea7
to
ce8fd28
Compare
src/core/PathMaster.ts
Outdated
@@ -328,7 +328,7 @@ export class PathMaster { | |||
let folder = path.isAbsolute(name) ? name : path.join(root, name); | |||
const folderPath = this.testFolder(folder, name); | |||
if (folderPath) { | |||
return { resolved: folderPath } | |||
return { resolved: folderPath, alias: name } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding alias here doesn't really do anything
e082f25
to
aa42edc
Compare
src/core/PathMaster.ts
Outdated
let result | ||
const pkg = this.tryReadPkg(folder) | ||
if (pkg && pkg.main) { | ||
result = path.join(name, pkg.main) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return an alias (FuseBox will regenerate the code and point to a correct file)
4aa79c4
to
424a01a
Compare
424a01a
to
a5e9ede
Compare
validPath = $pathJoin(filePath, "/", "index.js"); | ||
file = pkg.f[validPath]; | ||
|
||
if (!file && filePath === ".") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to modify the loader? Which case does it cover? require(".")
?
Shouldn't it require index if exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, So here is an example of it being hit
https://github.com/calebboyd/fuse-test
Adding a log in that if block (L301)
console.log('loading: "', name, '" filePath: "', filePath, '" entry: "', pkg.s.entry, '"')
->
loading: " ../ " filePath: " . " entry: " test.js "
loading: " ../../ " filePath: " . " entry: " test.js "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It covers any fully relative path that resolves to the package.json in the root of the package ("."
)
Amazing, almost there, let's verify a few things before merging |
Bundled a new project with fusebox today. It uses |
This correctly identifies the main file (afaict)
But its still not resolving to the correct module. (null at runtime), so some tests are probably broken