Skip to content

Commit c65ed98

Browse files
committed
Updated paths for webpack config and bundle tracker output file
1 parent 0fa0ea8 commit c65ed98

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ STATICFILES_DIRS = (
5353
```
5454

5555
<br>
56-
Assuming your webpack config lives at `./assets/webpack.config.js` and looks like this
56+
Assuming your webpack config lives at `./webpack.config.js` and looks like this
5757
```javascript
5858
module.exports = {
5959
context: __dirname,
6060
entry: {
61-
app: './js/index'
61+
app: './assets/js/index'
6262
output: {
6363
path: require('path').resolve('./assets/bundles/'),
6464
filename: '[name]-[hash].js',
6565
},
6666

6767
plugins: [
68-
new BundleTracker({filename: './assets/webpack-stats.json'})
68+
new BundleTracker({filename: './webpack-stats.json'})
6969
]
7070
}
7171

@@ -92,7 +92,7 @@ WEBPACK_LOADER = {
9292
}
9393
```
9494
95-
`BUNDLE_DIR_NAME` refers to the dir in which webpack outputs the bundles. It should not be the full path. If `./assets` it one of you static dirs and webpack generates the bundles in `./assets/output/bundles/`, then `BUNDLE_DIR_NAME` should be `output/bundles/`.
95+
`BUNDLE_DIR_NAME` refers to the dir in which webpack outputs the bundles. It should not be the full path. If `./assets` is one of you static dirs and webpack generates the bundles in `./assets/output/bundles/`, then `BUNDLE_DIR_NAME` should be `output/bundles/`.
9696
9797
If the bundle generates a file called `main-cf4b5fab6e00a404e0c7.js` and your STATIC_URL is `/static/`, then the `<script>` tag will look like this
9898
@@ -105,17 +105,17 @@ If the bundle generates a file called `main-cf4b5fab6e00a404e0c7.js` and your ST
105105
#### STATS_FILE
106106
```python
107107
WEBPACK_LOADER = {
108-
'STATS_FILE': os.path.join(BASE_DIR, 'assets/webpack-stats.json')
108+
'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json')
109109
}
110110
```
111111
112112
`STATS_FILE` is the filesystem path to the file generated by `webpack-bundle-tracker` plugin. If you initialize `webpack-bundle-tracker` plugin like this
113113
114114
```javascript
115-
new BundleTracker({filename: './assets/webpack-stats.json'})
115+
new BundleTracker({filename: './webpack-stats.json'})
116116
```
117117
118-
and your webpack config is located at `/home/src/assets/webpack.config.js`, then the value of `STATS_FILE` should be `/home/src/assets/webpack-stats.json`
118+
and your webpack config is located at `/home/src/webpack.config.js`, then the value of `STATS_FILE` should be `/home/src/webpack-stats.json`
119119
120120
<br>
121121
@@ -181,14 +181,14 @@ INSTALLED_APPS = (
181181
**It is up to you**. There are a few ways to handle this. I like to have slightly separate configs for production and local. I tell git to ignore my local stats + bundle file but track the ones for production. Before pushing out newer version to production, I generate a new bundle using production config and commit the new stats file and bundle. I store the stats file and bundles in a directory that is added to the `STATICFILES_DIR`. This gives me integration with collectstatic for free. The generated bundles are automatically collected to the target directory and synched to S3.
182182
183183
184-
`./assets/webpack_production.config.js`
184+
`./webpack_production.config.js`
185185
```javascript
186186
config = require('./webpack.config.js');
187187

188188
config.output.path = require('path').resolve('./assets/dist');
189189

190190
config.plugins = [
191-
new BundleTracker({filename: './assets/webpack-stats-prod.json'})
191+
new BundleTracker({filename: './webpack-stats-prod.json'})
192192
]
193193

194194
// override any other settings here like using Uglify or other things that make sense for production environments.
@@ -201,7 +201,7 @@ module.exports = config;
201201
if not DEBUG:
202202
WEBPACK_LOADER.update({
203203
'BUNDLE_DIR_NAME': 'dist/',
204-
'STATS_FILE': os.path.join(BASE_DIR, 'assets/webpack-stats-prod.json'
204+
'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats-prod.json'
205205
})
206206
```
207207

0 commit comments

Comments
 (0)