django-vuejs-tutorial
django-vuejs-tutorial copied to clipboard
Error reading webpack-stats.json
Hi I follow exactly your tutorial, and the webpack-stats.json was generated inside the assets/bundles/webpack-stats.json
I try to preview at browser, and got this error
Error reading /Users/cyberfly/learndjango/webpack-stats.json. Are you sure webpack has generated the file and the path is correct?
this is my directory
learndjango
- assets
-- bundles
--- webpack-stats.json
- learndjango
- myapp
settings.py
WEBPACK_LOADER = {
'DEFAULT': {
'BUNDLE_DIR_NAME': 'bundles/',
'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'),
}
}
webpack.config.js is located inside project folder root
Can you help me identify what is wrong here?
I had the same problem. When you run the command ./node_modules/.bin/webpack, the file webpack-stats.json is created in the assets/bundles folder. So, you should change de folder in the settings.py, e.g.: WEBPACK_LOADER = { 'DEFAULT': { 'BUNDLE_DIR_NAME': 'bundles/', 'STATS_FILE': os.path.join(BASE_DIR, 'assets, bundles', 'webpack-stats.json'), } } But, maybe you will another error (string indices must be integers). It's happen because the alpha version from webpack-bundle-tracker. So, I downgrade version to npm install --save-dev [email protected]. When you run the ./node_modules/.bin/webpack, will be created the file webpack-stats.json the root folder, then is necessary change settings.py, e.g. 'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'),
More information: https://stackoverflow.com/questions/61125880/exception-value-string-indices-must-be-integers-render-bundle-error-vue-dja