forked from webpack/webpack-dev-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref webpack#581
- Loading branch information
Showing
36 changed files
with
223 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
root = true | ||
|
||
[*.js] | ||
[*.{js,html,less}] | ||
indent_style=tab | ||
trim_trailing_whitespace=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Examples | ||
|
||
Each example showcases a feature. You can use this to learn how to use that feature, but also when making a Pull Request. | ||
|
||
An example should be as minimal as possible, and consists of: | ||
|
||
- The code that is necessary | ||
- Instructions on how to run | ||
- A description of what should happen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# https | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --open --https | ||
``` | ||
|
||
A fake certificate is used to enable https. | ||
|
||
## What should happen | ||
|
||
The script should open `https://localhost:8080/`. Your browser will probably give you a warning about using an invalid certificate. After ignoring this warning, you should see "It's working." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
document.write("It's working."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="bundle.js" type="text/javascript" charset="utf-8"></script> | ||
</head> | ||
<body> | ||
<h1>Example: https</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
context: __dirname, | ||
entry: "./app.js", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Modus: iframe | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --no-inline --open | ||
``` | ||
|
||
The app is started in an iframe. The page contains the client script to connect to webpack-dev-server. | ||
|
||
## What should happen | ||
|
||
It should open `http://localhost:8080/webpack-dev-server/`. In the bar at the top, the text should say `App ready.` | ||
|
||
In `app.js`, uncomment the code that results in an error and save. The bar at the top should display `Errors while compiling. App updated with errors. No reload!` with a stack trace underneath it. | ||
|
||
Then, in `app.js`, uncomment the code that results in a warning. The bar at the top should display `Warnings while compiling.`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
document.write("It's working."); | ||
|
||
// This results in a warning: | ||
// if(!window) require("./" + window + "parseable.js"); | ||
|
||
// This results in an error: | ||
// if(!window) require("test"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="bundle.js" type="text/javascript" charset="utf-8"></script> | ||
</head> | ||
<body> | ||
<h1>Example: iframe</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
context: __dirname, | ||
entry: "./app.js", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Modus: inline | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --open | ||
``` | ||
|
||
This opens the app in `inline` modus (which is the default). | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --open --config alternative.config.js | ||
``` | ||
|
||
This also opens the app in `inline` modus, but with a custom config. | ||
|
||
## What should happen | ||
|
||
The script should open `http://localhost:8080/`. It should display "It's working" with a dotted background. | ||
|
||
In `app.js`, uncomment the code that results in an error and save. This error should be visible in the CLI and devtools. | ||
|
||
Then, in `app.js`, uncomment the code that results in a warning. This warning should be visible in the CLI and devtools. | ||
|
||
Also try to change something in `style.less`. The browser should refresh, and the change should be visible in the app. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Modus: lazy | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --open --lazy | ||
``` | ||
|
||
With the `lazy` modus, webpack-dev-server does *not* watch the files, automatically recompiles them and refresh the browser. Instead, it only compiles after you manually refresh the page. | ||
|
||
## What should happen | ||
|
||
The script should open `http://localhost:8080/`. You should see "It's working." | ||
|
||
Change something in `app.js` and save. Check that in the CLI, nothing changed. Also check that in the browser, the old content is still displayed. | ||
|
||
Now refresh the app. The CLI should now compile. In the app you should now see the new content. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
document.write("It's working."); | ||
|
||
// This results in a warning: | ||
// if(!window) require("./" + window + "parseable.js"); | ||
|
||
// This results in an error: | ||
// if(!window) require("test"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="bundle.js" type="text/javascript" charset="utf-8"></script> | ||
</head> | ||
<body> | ||
<h1>Example: lazy</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
context: __dirname, | ||
entry: "./app.js", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Modus: manual script | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --open | ||
``` | ||
|
||
The webpack-dev-server client is added as script tag to the html page. | ||
|
||
## What should happen | ||
|
||
Try to update app.js by uncommenting some lines. The browser should reflect your changes. | ||
|
||
If there is a compilation error or warning, this should be displayed in the CLI and devtools. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
document.write("It's working."); | ||
|
||
// This results in a warning: | ||
// if(!window) require("./" + window + "parseable.js"); | ||
|
||
// This results in an error: | ||
// if(!window) require("test"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
context: __dirname, | ||
entry: "./app.js", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Webpack config array | ||
|
||
```shell | ||
node ../../bin/webpack-dev-server.js --open | ||
``` | ||
|
||
This opens the app with two webpack configs. | ||
|
||
## What should happen | ||
|
||
The script should open `http://localhost:8080/`. It should display "It's working" with a dotted background. | ||
|
||
Browsing to `http://localhost:8080/bundle2.js` should show a minified JS bundle. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require("./style.less"); | ||
|
||
document.write("It's working."); | ||
|
||
// This results in a warning: | ||
// if(!window) require("./" + window + "parseable.js"); | ||
|
||
// This results in an error: | ||
// if(!window) require("test"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="/bundle.js" type="text/javascript" charset="utf-8"></script> | ||
</head> | ||
<body> | ||
<h1>Example: webpack config array</h1> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: url(pixels.png); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.