Extending webpack.native.config to load other file types

0
Hi, I’ve been trying a react native widget which requires png files, which are not in the standard webpack config. After struggling for a while with extending it I decided to extend the module rules in the @mendix/pluggable-widgets-tools, thus altering the file which is not very sustainable. My question is: how can I extend webpack.native.config from within my project.   The added lines:             {                 test: /\.(png|jpe?g|gif)$/i,                 use: { loader: "file-loader"}             }
asked
1 answers
1

Hello,

You can extend the webpack for a pluggable widget by following the below:

Webpack extensibility

To extend the current webpack configurations and add your own custom features, you can create a file inside the root of your project with the files webpack.config.dev.js or webpack.config.prod.js according to your necessity.

From https://github.com/mendix/pluggable-widgets-tools

 

I have used the file loader in another project and used the following:

const customConfig = {

    module: {

        rules: [

          {

            test: /\.(png|jpe?g|gif)$/i,

            use: [

              {

                loader: 'file-loader',

              },

            ],

          },

        ],

      },

};

answered