TypeError: Ajv is not a constructor
vertic4l opened this issue · 5 comments
Bug report
Actual Behavior
After upgrading from version 0.11.2 (ya i'm late) to 2.6.0 of mini-css-extract-plugin we notice build issues:
TypeError: Ajv is not a constructor
at Object.<anonymous> (/Sites/frontend-portal/src/node_modules/mini-css-extract-plugin/node_modules/schema-utils/dist/validate.js:66:13)
Expected Behavior
Well, you know what is expected. I've looked into the source of validate.js and seems to be okay, but the error exists.
How Do We Reproduce?
I'm not sure, we have the latest versions of webpack, typescript and mini-css-extract-plugin and it fails to build.
So maybe have the same?
Please paste the results of npx webpack-cli info
here, and mention other relevant information
System:
OS: macOS 11.6.4
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 242.55 MB / 16.00 GB
Binaries:
Node: 17.7.1 - /usr/local/bin/node
npm: 8.5.2 - /usr/local/bin/npm
Browsers:
Chrome: 99.0.4844.83
Firefox: 84.0.2
Safari: 15.3
Packages:
copy-webpack-plugin: ^6.2.1 => 6.3.0
css-loader: ^3.4.2 => 3.6.0
esbuild-loader: ^2.18.0 => 2.18.0
file-loader: ^5.0.2 => 5.1.0
html-webpack-harddisk-plugin: ^2.0.0 => 2.0.0
html-webpack-plugin: ^5.3.2 => 5.3.2
postcss-loader: ^4.0.2 => 4.2.0
react-hot-loader: ^4.12.18 => 4.13.0
sass-loader: 12.3.0 => 12.3.0
script-ext-html-webpack-plugin: ^2.1.4 => 2.1.5
style-loader: ^1.2.1 => 1.3.0
terser-webpack-plugin: ^5.3.1 => 5.2.4
thread-loader: ^3.0.0 => 3.0.1
url-loader: ^3.0.0 => 3.0.0
webpack: ^5.54.0 => 5.70.0
webpack-bundle-analyzer: ^4.0.0 => 4.0.0
webpack-cli: ^4.8.0 => 4.9.2
webpack-dev-server: ^4.3.0 => 4.7.4
Can you once try removing node_modules
and re-installing? rm -rf node_modules && yarn install
?
@harish-sethuraman i already tried this but nothing changed.
You have outdated version of Ajv, they have bug with deps, we can't fix it here
npm install --save-dev ajv
fixes it. thanks guys
FWIW, it seems npm up ajv
will update the sub-dependency in your package-lock.json, even without explicitly installing ajv
as a dependency.