Skip to content

Commit 12742a9

Browse files
authored
Merge branch 'master' into patch-1
2 parents 7761f40 + 271ca48 commit 12742a9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/content/guides/asset-management.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ contributors:
66
- michael-ciniawsky
77
- TheDutchCoder
88
- sudarsangp
9+
- chenxsan
910
---
1011

1112
If you've been following the guides from the start, you will now have a small project that shows "Hello webpack". Now let's try to incorporate some other assets, like images, to see how they can be handled.
@@ -325,7 +326,7 @@ __project__
325326
|- /node_modules
326327
```
327328

328-
With the loader configured and fonts in place, you can use incorporate them via an `@font-face` declaration. The local `url(...)` directive will be picked up by webpack just as it was with the image:
329+
With the loader configured and fonts in place, you can incorporate them via an `@font-face` declaration. The local `url(...)` directive will be picked up by webpack just as it was with the image:
329330

330331
__src/style.css__
331332

src/content/guides/production.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ __webpack.prod.js__
177177
+ sourceMap: true
178178
+ })
179179
]
180-
})
180+
});
181181
```
182182

183183
T> Avoid `inline-***` and `eval-***` use in production as they can increase bundle size and reduce the overall performance.
@@ -200,12 +200,13 @@ __webpack.prod.js__
200200
plugins: [
201201
new UglifyJSPlugin({
202202
sourceMap: true
203-
}),
203+
- })
204+
+ }),
204205
+ new webpack.DefinePlugin({
205206
+ 'process.env.NODE_ENV': JSON.stringify('production')
206207
+ })
207208
]
208-
})
209+
});
209210
```
210211

211212
T> Technically, `NODE_ENV` is a system environment variable that Node.js exposes into running scripts. It is used by convention to determine dev-vs-prod behavior by server tools, build scripts, and client-side libraries. Contrary to expectations, `process.env.NODE_ENV` is not set to `"production"` __within__ the build script `webpack.config.js`, see [#2537](https://github.com/webpack/webpack/issues/2537). Thus, conditionals like `process.env.NODE_ENV === 'production' ? '[name].[hash].bundle.js' : '[name].bundle.js'` within webpack configurations do not work as expected.

0 commit comments

Comments
 (0)