-
-
Notifications
You must be signed in to change notification settings - Fork 255
feat(index): add context to outputPath
&& publicPath
#157
Conversation
I propose to add issuerContext to outputPath and publicPath to allow users change the resolved paths dynamically (eg. implementing relative path by myself). BTW, the outputPath should can be changed by the users after using "useRelativePath" because it will emit files to wrong paths (eg. files will be placed to parent folder of output path when it starts with "").
Knock, knock. Nobody's there? |
@adriancmiranda Thank you. I didn't mean that I only wanna fix the bug, but also wanna let the users handle the paths by themselves. |
@lsycxyj Sry we are shaping up a few things behind the scences in terms of CSS handling and this likely affects |
@michael-ciniawsky I'm looking forward to your good news. : ) |
@lsycxyj Can you please provide a small example for this, just to clarify ? :) |
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.
Please add a test for this aswell
index.js
Outdated
@@ -38,8 +38,8 @@ module.exports = function(content) { | |||
var outputPath = ""; | |||
|
|||
var filePath = this.resourcePath; | |||
var issuerContext = this._module && this._module.issuer && this._module.issuer.context || context; |
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.
nitpick issuerContext
=> issuer || context
(personally context
)
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, better clean this up.
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.
@michael-ciniawsky Well... Actually this line of code is from the master
branch. I just moved it outside the block. Do you mean I should choose issuer
or context
to pass to the publicPath
function?
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.
@michael-ciniawsky My purpose of adding issuer's context to the publicPath
function is to give the user a way to the resolved path trickily (eg. I can give a new relative path according to the issuer's context). So I prefer the issuer's context personally.
But I didn't fix the "useRelativePath" bug in this patch.
I notice that all the test cases are mocked cases, and there's no (good) way to find out problems caused by the webpack APIs (eg. this._module
).
I'm not familiar with the webpack APIs. Maybe I need some help or advice to test it in a better way.
BTW, this._module
has been deprecated by official docs. Maybe it should be changed in some other way?
outputPath
&& publicPath
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.
Not really worth reviewing until a pull request has tests / negative tests covering the new functionality.
@d3viant0ne @michael-ciniawsky Tests added. |
@lsycxyj friendly ping |
@evilebottnawi Is there anything I need to do? |
outputPath
&& publicPath
outputPath
&& publicPath
Done in #305 |
My idea was merged into the library but I'm not in the contributors list. 😢 |
@lsycxyj what do you mean? |
I propose to add issuerContext to outputPath and publicPath to allow users change the resolved paths dynamically (eg. implementing relative path by myself).
BTW, the outputPath should be able to be changed by the users after using "useRelativePath" because it will emit files to wrong paths (eg. files will be placed to parent folder of output path when it starts with "..").