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

Follow up PR for module scoping #2198

Merged
merged 3 commits into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 9 additions & 5 deletions packages/react-dev-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var publicUrl = '/my-custom-url';
module.exports = {
output: {
// ...
publicPath: publicUrl + '/'
publicPath: publicUrl + '/'
},
// ...
plugins: [
Expand Down Expand Up @@ -68,10 +68,14 @@ var ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');

module.exports = {
// ...
plugins: [
new ModuleScopePlugin(paths.appSrc),
resolve: {
// ...
],
plugins: [
new ModuleScopePlugin(paths.appSrc),
// ...
],
// ...
},
// ...
}
```
Expand Down Expand Up @@ -132,7 +136,7 @@ console.log('Just cleared the screen!');

#### `eslintFormatter(results: Object): string`

This is our custom ESLint formatter that integrates well with Create React App console output.
This is our custom ESLint formatter that integrates well with Create React App console output.<br>
You can use the default one instead if you prefer so.

```js
Expand Down
25 changes: 25 additions & 0 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,25 @@ function verify_env_url {
mv package.json.orig package.json
}

function verify_module_scope {
# Create stub json file
echo "{}" >> sample.json

# Save App.js, we're going to modify it
cp src/App.js src/App.js.bak

# Add an out of scope import
echo "import sampleJson from '../sample'" | cat - src/App.js > src/App.js.temp && mv src/App.js.temp src/App.js

# Make sure the build fails
npm run build; test $? -eq 1 || exit 1
# TODO: check for error message

# Restore App.js
rm src/App.js
mv src/App.js.bak src/App.js
}

# Enter the app directory
cd test-app

Expand All @@ -251,6 +270,9 @@ npm start -- --smoke-test
# Test environment handling
verify_env_url

# Test reliance on webpack internals
verify_module_scope

# ******************************************************************************
# Finally, let's check that everything still works after ejecting.
# ******************************************************************************
Expand Down Expand Up @@ -287,5 +309,8 @@ npm start -- --smoke-test
# Test environment handling
verify_env_url

# Test reliance on webpack internals
verify_module_scope

# Cleanup
cleanup