Cannot create custom pluggable web widget (except if....)

0
I followed this tutorial: https://docs.mendix.com/howto/extensibility/create-a-pluggable-widget-one But even after run the yo @mendix/widget TextBox command, it returns an error (however it succeed). ...later on, when you want to activate your widget, and start the build with ``npm start`` – it will return the same error, but this time, it’s fatal. The error is: [!] TypeError: The "path" argument must be of type string. Received an instance of RegExp TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of RegExp at validateString (internal/validators.js:124:11) at Object.resolve (path.js:162:9) at <yourProject>\textBox\node_modules\rollup-plugin-sass\node_modules\rollup-pluginutils\dist\pluginutils.cjs.js:184:68 at Array.map (<anonymous>) at Object.createFilter (<yourProject>\textBox\node_modules\rollup-plugin-sass\node_modules\rollup-pluginutils\dist\pluginutils.cjs.js:184:35) at Object.plugin [as default] (<yourProject>\textBox\node_modules\rollup-plugin-sass\src\index.ts:134:14) at <yourProject>\textBox\node_modules\@mendix\pluggable-widgets-tools\configs\rollup.config.js:298:45 at Array.forEach (<anonymous>) at rollup_config (<yourProject>\textBox\node_modules\@mendix\pluggable-widgets-tools\configs\rollup.config.js:286:23) at getConfigList (<yourProject>\textBox\node_modules\rollup\dist\shared\loadConfigFile.js:566:11) I could fix it, by fixing the 3rdparty code itself, by adding the 2nd line in this file: ``...\node_modules\rollup-plugin-sass\node_modules\rollup-pluginutils\dist\pluginutils.cjs.js `` function createFilter ( include, exclude ) { include = include.toString(); // ADD THIS LINE! include = ensureArray( include ).map( function (id) { return path.resolve( id ); } ).map( function (id) { return new minimatch.Minimatch(id); } ); exclude = ensureArray( exclude ).map( function (id) { return path.resolve( id ); } ).map( function (id) { return new minimatch.Minimatch(id); } ); return function ( id ) { if ( typeof id !== 'string' ) return false; if ( /\0/.test( id ) ) return false; var included = !include.length; id = id.split(path.sep).join('/'); include.forEach( function (minimatch) { if ( minimatch.match( id ) ) included = true; }); exclude.forEach( function (minimatch) { if ( minimatch.match( id ) ) included = false; }); return included; }; }   Now it’s works, but it’s not a really good solution. Anyone met that issue?
asked
1 answers
1

I encounter the same issue.


I fix it by adding  "rollup-plugin-sass": "1.2.4" as dev dependencies on your packages.json, and perform “npm install” , maybe until mendix update their pluggable-widget-tools. 

I’ve seen the fix merged into the repository (fix(pluggable-widgets-tools): downgrade rollup-plugin-sass version by diego-antonelli · Pull Request #858 · mendix/widgets-resources · GitHub) but not sure when a new version is going to be released. 

answered
0

i Have a generic Solution for everything :

A-  in Start/CMD 
1- npm install –g npm@8.6.0 
2- npm install –g yo 
3- npm install –g @mendix/generator-widget
4- npm install @mendix/pluggable-widgets-tools --legacy-peer-deps  


B- in your widget Folder  :
B.1 - in package.json Change the @mendix/pluggable-widgets-tools Version in the devDependencies object to : 

...............},
//------------------------------------------------
"devDependencies": {
    "@mendix/pluggable-widgets-tools": "^9.20.0"
  },
//------------------------------------------------
"dependencies": { ....


B.2  open the Terminal (CMD) in your widget folder and run the following command 
2-   npm i

i Have a generic Solution for everything :

A-  in Start/CMD 
1- npm install –g npm@8.6.0 
2- npm install –g yo 
3- npm install –g @mendix/generator-widget
4- npm install @mendix/pluggable-widgets-tools --legacy-peer-deps  


B- in your widget Folder  :
B.1 - in package.json Change the @mendix/pluggable-widgets-tools Version in the devDependencies object to : 

...............},
//------------------------------------------------
"devDependencies": {
    "@mendix/pluggable-widgets-tools": "^9.20.0"
  },
//------------------------------------------------
"dependencies": { ....


B.2  open the Terminal (CMD) in your widget folder and run the following command 
2-   npm i


 

answered