Hi Ivo,
The standard pluggable widget webpack can be extended by adding the following files into your pluggable widget project folder: webpack.config.dev.js
or webpack.config.prod.js
https://github.com/mendix/pluggable-widgets-tools#webpack-extensibility
You can then use the ‘copy-webpack-plugin’ to transfer the folder to the temporary folder that is created before it is zipped into the mpk.
The npm package ‘copy-webpack-plugin’ should be installed using npm install copy-webpack-plugin --save-dev
Your webpack should look a little bit like the below:
const merge = require("webpack-merge");
const baseConfig = require("./node_modules/@mendix/pluggable-widgets-tools/configs/webpack.config.dev.js"); //Can also be webpack.config.prod.js
const CopyWebpackPlugin = require("copy-webpack-plugin");
const customConfig = {
plugins: [
new CopyWebpackPlugin({
patterns: [
{from: './src/assets', to:'./widgets/mendix/widgetname/assets'}
]
})
],
};
module.exports = [merge(baseConfig[0], customConfig)];
Thanks Joe, that pushed me in the right direction! I did need to follow three extra steps:
This is what my package.json dependencies part now looks like:
"devDependencies": {
"@arcgis/webpack-plugin": "^4.18.0",
"@mendix/pluggable-widgets-tools": "^8.14.0",
"@types/big.js": "^4.0.5",
"@types/classnames": "^2.2.4",
"@types/react": "~16.9.0",
"@types/react-dom": "~16.9.0",
"copy-webpack-plugin": "^6.2.1",
"file-loader": "^6.2.0",
"webpack": "^5.37.1",
"webpack-cli": "^4.7.0",
"webpack-merge": "^5.7.3"
},
"dependencies": {
"@arcgis/core": "^4.19.3",
"classnames": "^2.2.6"
}