khadija.EL
khadija.EL

Reputation: 307

Getting a Webpack error when trying to run yarn run build-assets

I'm trying to create a web app using Django for backend and Vue.js for frontend, and to make that happen I had to use the module bundler "webpack", but after I made all the necessary configurations and run the Django server it gives me this error.

OSError at / Error reading project_path\webpack-stats.json. Are you sure webpack has generated the file and the path is correct?

I found out that the webpack-stats.json wasn't generated, so I made some research of how to generate a webpack-stats.json file, after I found that the command

yarn run build-assets

is supposed to generate that file automatically. but when I run it, it gives the following error

An unexpected error occurred: "Command \"build-assets\" not found."

Is there any other solution so I can generate webpack-stats.json file?

Upvotes: 3

Views: 2086

Answers (1)

aiotrope
aiotrope

Reputation: 186

Try to install the earlier version of the packages such as django-webpack-loader==0.6.0 and [email protected]. Then run yarn serve or npm run serve for npm users to create the webpack-stats.json on the frontend directory.

Packages with version, django-webpack-loader==0.7.0, and [email protected] cannot automatically generate webpack-stats.json and will likely to cause OSError.

For projects using Django==3.0.6 and @vue/cli 4.3.1.

Upvotes: 2

Related Questions