Skip to content
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
3 changes: 3 additions & 0 deletions src/components/Splash/build/development.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
npx webpack --mode development
```
3 changes: 3 additions & 0 deletions src/components/Splash/build/production.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
npx webpack --mode production
```
3 changes: 0 additions & 3 deletions src/components/Splash/second/left.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ export default {
output: {
// the page loads a `<script type="module">`, so emit ES modules to match
module: true,
filename: "[contenthash].js",
cssFilename: "[contenthash].css",
htmlFilename: "[name].html",
},
};
```
Expand Down
4 changes: 2 additions & 2 deletions src/components/Splash/second/right.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<head>
<meta charset="utf-8" />
<title>My App</title>
<link rel="stylesheet" href="725d71b1a0d330cfd1ad.css" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<script type="module" src="91b32a0aad9e59b71d57.js"></script>
<script type="module" src="index.mjs"></script>
</body>
</html>
```
2 changes: 1 addition & 1 deletion src/content/configuration/optimization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default {
};
```

W> If you are using webpack [CLI](/api/cli/), the webpack process will not exit with an error code while this plugin is enabled. If you want webpack to "fail" when using the CLI, please check out the [`bail` option](/api/cli/#advanced-options).
W> If you are using webpack [CLI](/api/cli/), the webpack process will not exit with an error code while this plugin is enabled. If you want webpack to "fail" when using the CLI, please check out the [`bail` option](/configuration/other-options/#bail).

## optimization.avoidEntryIife

Expand Down
20 changes: 19 additions & 1 deletion src/content/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import FirstRight from "../components/Splash/first/right.mdx";
import SecondLeft from "../components/Splash/second/left.mdx";
import SecondRight from "../components/Splash/second/right.mdx";
import Install from "../components/Splash/install/install.mdx";
import BuildDevelopment from "../components/Splash/build/development.mdx";
import BuildProduction from "../components/Splash/build/production.mdx";

## Install Webpack

Expand Down Expand Up @@ -40,7 +42,23 @@ import Install from "../components/Splash/install/install.mdx";
</div>
</div>

Then run `webpack` on the command-line: HTML, CSS and JavaScript are all handled by webpack itself, so `dist/` ends up with the page and the hashed assets it points at.
Then run webpack on the command-line. HTML, CSS and JavaScript are all handled by webpack itself, so `dist/` ends up with the page and the assets it points at.

<div className="splash__wrap">
<div className="splash__install">
<BuildDevelopment />
</div>
</div>

[`--mode development`](/configuration/mode/) leaves the page and the stylesheet unminified and maps the bundle back to your own files in browser devtools, so what you debug looks like what you wrote.

<div className="splash__wrap">
<div className="splash__install">
<BuildProduction />
</div>
</div>

[`--mode production`](/configuration/mode/) minifies the page, the stylesheet and the script, and drops the code nothing uses. That is the build you deploy.

## Awesome, isn't it? Let's dive in!

Expand Down
Loading