Django version "npm run build" not working (metronic_v8.2.3)
Hello, great job! Thank you for such a nice template. Unfortunately, the Django version isn't working. The command: npm run build fails with an error:
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/max/projects/metronic_django_v8.2.3/starterkit/_keenthemes/tools/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Replacing webpack.config.js -> webpack.config.cjs doesn't help either, and npm run build still fails with an error.
metronic_v8.2.3
Replies (1)
Hi Maxix,
To resolve the issue with npm run build, you have to modify the tools/package.json file as follows:
- Open the
tools/package.jsonfile. - Find the line
"type": "module",and remove it.
After removing "type": "module", from tools/package.json, try running npm run build again.