I'm writing an extension for Flarum, and I've been following the docs for setting up webpack etc... The docs say to use Webpack 4, but I've seen on Github Flarum supports Webpack 5, and since 4 gives vulnerability warnings I figured I would use 5.
However, the issue that is stated to be fixed in this issue + PR here is still happening to me on v1.1.1
flarum/core2855
flarum/core3135
If I downgrade to 4, it works and does a console.log
, otherwise if I upgrade to 5 it does the same error shown in the issue; index.js:94 Uncaught TypeError: {} is not a function
This is my package.json
{
"private": true,
"name": "my-ext",
"dependencies": {
"flarum-webpack-config": "^2.0.0",
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0"
},
"devDependencies": {
"flarum-tsconfig": "^1.0.0"
},
"scripts": {
"dev": "webpack --mode development --watch",
"build": "webpack --mode production"
}
}