Skip to content

Commit

Permalink
EZP-30406: Cannot add custom webpack config from bundle (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
dew326 authored and Łukasz Serwatka committed Apr 5, 2019
1 parent 07b2f7c commit 19b2c00
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!/var/encore
/var/encore/*
!var/encore/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
Expand Down
12 changes: 12 additions & 0 deletions ez.webpack.custom.configs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');
const customConfigs = require('./var/encore/ez.webpack.custom.config.js');

module.exports = customConfigs.reduce((configs, customConfigPath) => {
let customConfig = require(customConfigPath);

if (!Array.isArray(customConfig)) {
customConfig = [customConfig];
}

return [ ...configs, ...customConfig ];
}, []);
Empty file added var/encore/.gitkeep
Empty file.
5 changes: 3 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const getEzConfig = require('./ez.webpack.config.js');
const eZConfigManager = require('./ez.webpack.config.manager.js');
const eZConfig = getEzConfig(Encore);
const customConfigs = require('./ez.webpack.custom.configs.js');

Encore.reset();
Encore.setOutputPath('web/assets/build')
Expand All @@ -15,7 +16,7 @@ Encore.setOutputPath('web/assets/build')

// uncomment the two lines below, if you added a new entry (by Encore.addEntry() or Encore.addStyleEntry() method) to your own Encore configuration for your project
// const projectConfig = Encore.getWebpackConfig();
// module.exports = [ eZConfig, projectConfig ];
// module.exports = [ eZConfig, ...customConfigs, projectConfig ];

// comment-out this line if you've uncommented the above lines
module.exports = eZConfig;
module.exports = [ eZConfig, ...customConfigs ];

0 comments on commit 19b2c00

Please sign in to comment.