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:
<plugin root>/src/Resources/app/administration/build/webpack.config.js
1
const path = require('path');
2
3
module.exports = () => {
4
return {
5
resolve: {
6
alias: {
7
SwagBasicExample: path.join(__dirname, '..', 'src')
8
}
9
}
10
};
11
};
Copied!
This way, the configuration is automatically loaded and then merged with the Shopware provided webpack configuration, including all other plugin webpack configurations. Merging is done with the webpackMerge library.
Copy link
Edit on GitHub