Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reading webpack-stats.json #20

Open
cyberfly opened this issue Apr 25, 2020 · 1 comment
Open

Error reading webpack-stats.json #20

cyberfly opened this issue Apr 25, 2020 · 1 comment

Comments

@cyberfly
Copy link

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?

@byander
Copy link

byander commented May 21, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants