Webpack
Last updated
Last updated
By creating a custom webpack configuration "extension" file in your project's elements source root directory, you can customize the compilation settings that the application uses when compiling.
First, create a new Javascript file in your project's root directory. The filename can be of your choosing. (for example, "webpack.js")
Next, you will need to set the "PFWP_CONFIG_WEBPACK" environment variable in your project's peanut.config.json file to match the name of that extension file you created above:
Finally, your Javascript file should export a function as the default. The function receives an object as it's parameter that has 2 properties: config (the default webpack configuration) and plugins (the plugins used by our webpack compilation). The function must return that config object.
You can modify that object within your exported function to change the webpack configuration. (See example below.)