Skip to content
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 detection of parent directory in ModuleScopePlugin #2405

Merged
merged 2 commits into from May 29, 2017

Conversation

Projects
None yet
4 participants
@diligiant
Copy link

commented May 29, 2017

This PR fixes #2404.

Frédéric Miserey
@facebook-github-bot

This comment has been minimized.

Copy link

commented May 29, 2017

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

@facebook-github-bot

This comment has been minimized.

Copy link

commented May 29, 2017

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@Timer

This comment has been minimized.

Copy link
Collaborator

commented May 29, 2017

LGTM, can you show me a sample path of this though? Curious to see the problem as I'm not really visualizing it too well.

@diligiant

This comment has been minimized.

Copy link
Author

commented May 29, 2017

Of course.

Module not found: You attempted to import /root_path_replaced_here/website/src/.tmp-globalize-webpack/dev-i18n-data.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

@Timer

This comment has been minimized.

Copy link
Collaborator

commented May 29, 2017

Oh okay, I didn't realize a webpack plugin would dirty your src directory. Makes perfect sense now, thanks! :)

@diligiant

This comment has been minimized.

Copy link
Author

commented May 29, 2017

I'm not expert enough to confirm nor deny your assertion ;)

@@ -49,7 +49,7 @@ class ModuleScopePlugin {
)
);
// Error if in a parent directory of src/
if (requestRelative[0] === '.') {
if (requestRelative.startsWith('../')) {

This comment has been minimized.

Copy link
@Timer

Timer May 29, 2017

Collaborator

This should probably use path.sep instead of / for cross platform reasons. 😄
You could also be explicit and just add a second case for \.


Should we change the check above, too? I'm not sure if people use dot directories often.

This comment has been minimized.

Copy link
@diligiant

diligiant May 29, 2017

Author

Thank you for the windows "reminder"! I added a second case to match the style above in the code.
I also fixed the first detection (different situation though).

@Timer
Copy link
Collaborator

left a comment

I don't believe this will work on Windows machines. Please see my comment.

@Timer Timer added the tag: bug fix label May 29, 2017

@Timer Timer added this to the 1.0.8 milestone May 29, 2017

Frédéric Miserey
Correct parent directory detection fix
Add windows specific path and extend to issuer path
@Timer

This comment has been minimized.

Copy link
Collaborator

commented May 29, 2017

Great, thanks!

@Timer

Timer approved these changes May 29, 2017

@gaearon gaearon merged commit bcf398d into facebook:master May 29, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

zangrafx added a commit to zangrafx/create-react-app that referenced this pull request May 31, 2017

Merge branch 'master' into zangrafx
* master:
  Add WebStorm >2017 launchEditor Support (facebook#2414)
  docs: update `jest-enzyme` section (facebook#2392)
  Fix detection of parent directory in ModuleScopePlugin (facebook#2405)
  Added cache clear to e2e scripts (facebook#2400)
  Fix kill command in e2e-kitchensink.sh cleanup (facebook#2397)
  Revert "Catch "No tests found" during CI" (facebook#2390)
  Fix wrong path expansion in end-to-end test (facebook#2388)
  Suggest just "yarn build" (facebook#2385)
  Catch "No tests found" during CI (facebook#2387)
  Publish
  Add changelog for 1.0.7 (facebook#2384)
  Update webpack to 2.6.1 (facebook#2383)
  Consistently set environment variables (facebook#2382)
  Disable comparisons feature in uglify compression in production (facebook#2379)
  Removed the overriding of reduce_vars to false since webpack v2.6.0 included the fixed for Uglify bug (facebook#2351)

kellyrmilligan added a commit to kellyrmilligan/create-react-app that referenced this pull request May 31, 2017

Merge branch 'master' into serve-app-under
* master:
  Fix docs typo (facebook#2420)
  Add WebStorm >2017 launchEditor Support (facebook#2414)
  docs: update `jest-enzyme` section (facebook#2392)
  Fix detection of parent directory in ModuleScopePlugin (facebook#2405)
  Added cache clear to e2e scripts (facebook#2400)
  Fix kill command in e2e-kitchensink.sh cleanup (facebook#2397)
  Revert "Catch "No tests found" during CI" (facebook#2390)
  Fix wrong path expansion in end-to-end test (facebook#2388)
  Suggest just "yarn build" (facebook#2385)
  Catch "No tests found" during CI (facebook#2387)
  Publish
  Add changelog for 1.0.7 (facebook#2384)
  Update webpack to 2.6.1 (facebook#2383)
  Consistently set environment variables (facebook#2382)
  Disable comparisons feature in uglify compression in production (facebook#2379)
  Removed the overriding of reduce_vars to false since webpack v2.6.0 included the fixed for Uglify bug (facebook#2351)
  Update README.md for `now` deployments (facebook#2372)
  Print file sizes with correct build folder path. (facebook#2361)
  Fix broken links (facebook#2350)
  Update webpack to v2.6.0 in react-scripts (facebook#2349)

@gaearon gaearon referenced this pull request Jun 28, 2017

Merged

Changelog for 1.0.8 #2664

christensena added a commit to christensena/create-react-app that referenced this pull request Jul 8, 2017

Fix detection of parent directory in ModuleScopePlugin (facebook#2405)
* Fix detection of parent directory

* Correct parent directory detection fix

Add windows specific path and extend to issuer path

romaindso added a commit to romaindso/create-react-app that referenced this pull request Jul 10, 2017

Fix detection of parent directory in ModuleScopePlugin (facebook#2405)
* Fix detection of parent directory

* Correct parent directory detection fix

Add windows specific path and extend to issuer path

wmonk referenced this pull request in wmonk/create-react-app-typescript Aug 7, 2017

Fix detection of parent directory in ModuleScopePlugin (#2405)
* Fix detection of parent directory

* Correct parent directory detection fix

Add windows specific path and extend to issuer path

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.