Skip to content

Extending Webpack

You are viewing the next version (v6.7) of the documentation.
Click here to switch to the stable version (v6.6), or use the version switcher on the left to navigate between versions.

Extending Webpack

Overview

The Shopware 6 Administration uses Webpack as a static module bundler. Normally you don't need to change the Webpack configuration, but if you need to here is how to do it.

Extending the Webpack configuration

The Webpack configuration can be extended by creating the file <plugin root>/src/Resources/app/administration/build/webpack.config.js and exporting a function from it. This will return a webpack configuration object, as seen below:

javascript
// <plugin root>/src/Resources/app/administration/build/webpack.config.js
const path = require('path');

module.exports = () => {
    return {
        resolve: {
            alias: {
                SwagBasicExample: path.join(__dirname, '..', 'src')
            }
        }
    };
};

This way, the configuration is automatically loaded and then merged with the Shopware provided webpack configuration. Configurations of plugins are not merged into each other. Merging is done with the webpackMerge library.