-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix Webpack.require() when file is outside cwd #37
Fix Webpack.require() when file is outside cwd #37
Conversation
haxelib/Webpack.hx
Outdated
@@ -126,7 +128,7 @@ class Webpack { | |||
} | |||
|
|||
if (directory != '') { | |||
return './${directory}/${file}'; | |||
return '${directory}/${file}'; | |||
} | |||
if (file.startsWith('.')) { |
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.
Shouldn't this be '..'
instead of '.'
?
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 think we need unit tests here before changing the behaviour.
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.
Sure. I don't have too much time for that atm though =/
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 this is a bit sensitive so I'll try to write some
d2dc156
to
2b3dd9d
Compare
test/src/HaxeTests.hx
Outdated
assert(rebaseRelativePath('src/a/b', './res') == './src/a/b/res'); | ||
assert(rebaseRelativePath('src/a/b', '../res') == './src/a/res'); | ||
assert(rebaseRelativePath('src/a/b', '../../res') == './src/res'); | ||
assert(rebaseRelativePath('src', './res') == 'src/res'); |
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 think the cases should be modified to be like rebaseRelativePath('./src', './res')
, and adding some dummy absolute paths, because that's what comes our the relativePath
function now.
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 started and yep, needs more work on both the tests and the implementation. I'll try to update this week-end (or maybe before if I find some time).
2b3dd9d
to
bd1afa8
Compare
a533235
to
add97a3
Compare
add97a3
to
71aa41b
Compare
I am using a strange environment where the main sources are outside the
cwd
.When requiring with
Webpack.require()
, I end up with paths like.//my/absolute/path/to/src/file.scss
which don't work.I tested this version with all my projects, it worked fine. I don't know about windows nor how far the test suite goes in testing this kind of things, though.
Now including changes from #36 too: