Skip to content

Extending Webpack

Extending Webpack


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:

// <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.