Skip to content

Commit 89e43f4

Browse files
author
rajagopal.r
committed
Add contributor && update file titles
1 parent f026e68 commit 89e43f4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

content/guides/production-build.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Building for Production
33
sort: 13
44
contributors:
55
- henriquea
6+
- rajagopal4890
67
---
78

89
Generating production builds with webpack is straight-forward. There are three things to keep in mind:
@@ -29,6 +30,7 @@ The `DefinePlugin` creates **compile** time constants. Useful for injecting your
2930

3031
```js
3132
// webpack.config.js
33+
3234
const webpack = require('webpack');
3335

3436
module.exports = {
@@ -52,6 +54,7 @@ webpack comes with UglifyJS plugin which minimize the output. You can pass an ob
5254

5355
```js
5456
// webpack.config.js
57+
5558
const webpack = require('webpack');
5659

5760
module.exports = {
@@ -75,7 +78,8 @@ module.exports = {
7578

7679
When we do have multiple configurations in mind for different environments, the easiest way is to write seperate js files for
7780
each environment. For example:
78-
#### config/dev.js
81+
82+
** dev.js **
7983
```js
8084
module.exports = function (env) {
8185
debug: true,
@@ -96,7 +100,8 @@ module.exports = function (env) {
96100
}
97101
}
98102
```
99-
#### config/prod.js
103+
104+
** prod.js **
100105
```js
101106
module.exports = function (env) {
102107
debug: false,
@@ -146,7 +151,7 @@ An advanced approach would be to have a base configuration file, put in all comm
146151
and then have environment specific files and simply use 'webpack-merge' to merge them. This would help to avoid code repetitions.
147152
For example, you could have all your base configurations like resolving your js, ts, png, jpeg, json and so on.. in a common base file as follows:
148153

149-
#### base.js
154+
** base.js **
150155
```js
151156
module.exports = function() {
152157
return {
@@ -203,7 +208,7 @@ module.exports = function() {
203208
And then merge this base config with an environment specific configuration file using 'webpack-merge'.
204209
Let us look at an example where we merge our prod file, mentioned above, with this base config file using 'webpack-merge':
205210

206-
#### prod.js (updated)
211+
** prod.js (updated) **
207212
```js
208213
const webpackMerge = require('webpack-merge');
209214

0 commit comments

Comments
 (0)