Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

refactor(index): use stringifyRequest to avoid absolute paths (loaderUtils.stringifyRequest) #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jimedelstein
Copy link

Per webpack documentation on building loaders (https://webpack.github.io/docs/how-to-write-a-loader.html), loaders should not use absolute paths, but this one does. This PR fixes the problem.

@jsf-clabot
Copy link

jsf-clabot commented Oct 26, 2017

CLA assistant check
All committers have signed the CLA.

@joshwiens
Copy link
Member

@jimedelstein - You will need to sign the CLA before this can move forward

@alexander-akait
Copy link
Member

@jimedelstein friendly ping

@michael-ciniawsky michael-ciniawsky changed the title Fix issue with absolute paths fix(index): use stringifyRequest to avoid absolute paths (loaderUtils.stringifyRequest) Sep 12, 2018
@michael-ciniawsky michael-ciniawsky added this to the 0.7.2 milestone Sep 12, 2018
@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Sep 12, 2018

@jimedelstein Please sign the CLA. Otherwise I'm going to close this PR within the next ~48-72 hours due to the missing CLA signment

@michael-ciniawsky michael-ciniawsky changed the title fix(index): use stringifyRequest to avoid absolute paths (loaderUtils.stringifyRequest) refactor(index): use stringifyRequest to avoid absolute paths (loaderUtils.stringifyRequest) Sep 12, 2018
@michael-ciniawsky michael-ciniawsky modified the milestones: 0.7.2, 1.0.0 Sep 12, 2018
@jimedelstein
Copy link
Author

@michael-ciniawsky I've signed it, unfortunately I didn't properly configure my git user when I made this commit. I was able to repair it and rebase it but I think I will have to make a new PR because it's still showing the default author info in addition to the correct info. Haven't had this problem before, please confirm that's the correct next step and there's not an easier way. Thanks

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Sep 12, 2018

(Squash the commits into one) and then

git commit --amend --author="Author Name <email@address.com>"

using the e-mail address matching with your Github Account or open an new PR

@jimedelstein
Copy link
Author

@michael-ciniawsky That's what basically what I did (I used rebase instead of squash). When I wrote that it showed both committers, but now it seems to be working, so I guess we're good now?

index.js Outdated
")";
};
this.cacheable && this.cacheable();
return "require(" + loaderUtils.stringifyRequest(this, "!!" + path.join(__dirname, "addScript.js")) + ")"+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- "addScript.js")) + ")"+
+ "addScript.js")) + ")" +

Missing Space

@michael-ciniawsky
Copy link
Member

@jimedelstein Please address the tiny nit mentioned #49 (comment) so I can proceed here :)

@jimedelstein
Copy link
Author

@michael-ciniawsky done (finally!)

@garygreen
Copy link

@michael-ciniawsky any news on this? script-loader completely breaks consistent hashing across different machines if it's using absolute paths. See this article about it: https://medium.com/@the_teacher/webpack-different-assets-hashes-on-different-machines-the-problem-the-solution-ec6383983b99

Can this be looked at urgently?

@halfnibble
Copy link

I too am very interested in this. Thanks.

@garygreen
Copy link

@michael-ciniawsky @evilebottnawi @sokra It's pretty rediclous that this hasn't been fixed yet. There's been a PR from the community trying to fix this issue since 2017, over 2 years and the last release of script-loader was back in Sep 2017 - is this project still maintained anymore? If the maintainers aren't willing to maintain it then can you at least deprecate/mark the project as abandoned because it really isn't fair to the community to let bugs like this sit around for so long.

Appreciate all the work and time that goes into maintaining a project but we do need more feedback and guidance from the maintainers.

@alexander-akait