Craco start failed with `compiler.plugin is not a function`
thanhtinhpas1 opened this issue · comments
What's happening
I'm using craco for starting project, so I try to configure webpack inside craco.config.js
to add a plugin to webpack.
But when start project I'm facing with the issue
Failed to compile.
compiler.plugin is not a function
I researched and found that when I'm using webpack 5, the property compiler.plugin
was removed, so I think craco should have a update for this, reference here
What should happen
It should start success with a new webpack plugin was attached
To reproduce
Add my config above with "@craco/craco": "^6.4.5"
and "react": "^18.2.0"
CRACO version
6.4.5
CRACO config
```javascript
module.exports = {
webpack: {
plugins: {
add: [
[new WebpackMd5Hash(), "append"],
],
},
configure: {
output: {
publicPath: (process.env.PUBLIC_URL ?? "") + "/",
filename: "static/js/[name].[chunkhash].js",
},
},
}
}
package.json
"dependencies": {
"@ant-design/cssinjs": "^1.5.6",
"@ant-design/icons": "^4.7.0",
"@craco/craco": "^6.4.5",
"@crowdin/cli": "^3.7.10",
"@ctrl/tinycolor": "^3.5.0",
"@emotion/react": "^11.10.5",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"antd": "5.1.6",
"antd-token-previewer": "^1.1.0-22",
"codemirror": "^5.61.1",
"copy-to-clipboard": "^3.3.1",
"core-js": "^3.25.0",
"craco-less": "^2.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"file-saver": "^2.0.5",
"i18n-iso-countries": "^7.0.0",
"i18next": "^19.8.9",
"libphonenumber-js": "^1.10.19",
"moment": "^2.29.1",
"qs": "^6.10.2",
"react": "^18.2.0",
"react-app-polyfill": "^3.0.0",
"react-codemirror2": "^7.2.1",
"react-cropper": "^2.1.7",
"react-device-detect": "^2.2.2",
"react-dom": "^18.2.0",
"react-github-corner": "^2.5.0",
"react-helmet": "^6.1.0",
"react-highlight-words": "^0.18.0",
"react-i18next": "^11.8.7",
"react-router-dom": "^5.3.3",
"react-scripts": "5.0.1",
"react-social-login-buttons": "^3.4.0"
}
Additional information
Close because this issue happened caused by my plugin which want to add