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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-dev-utils/ModuleScopePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ModuleScopePlugin {
)
);
// Error if in a parent directory of src/
if (requestRelative[0] === '.') {
if (requestRelative.startsWith('../')) {
Copy link
Contributor

@Timer Timer May 29, 2017

Choose a reason for hiding this comment

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

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.

Copy link
Author

@diligiant diligiant May 29, 2017

Choose a reason for hiding this comment

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

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).

callback(
new Error(
`You attempted to import ${chalk.cyan(request.__innerRequest_request)} which falls outside of the project ${chalk.cyan('src/')} directory. ` +
Expand Down