Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
c27d7650
Commit
c27d7650
authored
7 years ago
by
Joe Haddad
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Test module scoping (#2198)
* Correct readme * Add tests * Update README.md
parent
ee850f58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/react-dev-utils/README.md
+9
-5
packages/react-dev-utils/README.md
tasks/e2e-simple.sh
+25
-0
tasks/e2e-simple.sh
with
34 additions
and
5 deletions
+34
-5
packages/react-dev-utils/README.md
+
9
-
5
View file @
c27d7650
...
...
@@ -34,7 +34,7 @@ var publicUrl = '/my-custom-url';
module
.
exports
=
{
output
:
{
// ...
publicPath
:
publicUrl
+
'
/
'
publicPath
:
publicUrl
+
'
/
'
},
// ...
plugins
:
[
...
...
@@ -68,10 +68,14 @@ var ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
module
.
exports
=
{
// ...
plugins
:
[
new
ModuleScopePlugin
(
paths
.
appSrc
),
resolve
:
{
// ...
],
plugins
:
[
new
ModuleScopePlugin
(
paths
.
appSrc
),
// ...
],
// ...
},
// ...
}
```
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
tasks/e2e-simple.sh
+
25
-
0
View file @
c27d7650
...
...
@@ -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
...
...
@@ -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.
# ******************************************************************************
...
...
@@ -287,5 +309,8 @@ npm start -- --smoke-test
# Test environment handling
verify_env_url
# Test reliance on webpack internals
verify_module_scope
# Cleanup
cleanup
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment