forked from BitBagCommerce/SyliusElasticsearchPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
40 lines (31 loc) · 1.33 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const path = require('path');
const Encore = require('@symfony/webpack-encore');
const pluginName = 'elasticsearch';
const getConfig = (pluginName, type) => {
Encore.reset();
Encore
.setOutputPath(`public/build/bitbag/${pluginName}/${type}/`)
.setPublicPath(`/build/bitbag/${pluginName}/${type}/`)
.addEntry(`bitbag-${pluginName}-${type}`, path.resolve(__dirname, `./src/Resources/assets/${type}/entry.js`))
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableSassLoader();
const config = Encore.getWebpackConfig();
config.name = `bitbag-${pluginName}-${type}`;
return config;
}
Encore
.setOutputPath(`src/Resources/public/`)
.setPublicPath(`/public/`)
.addEntry(`bitbag-${pluginName}-shop`, path.resolve(__dirname, `./src/Resources/assets/shop/entry.js`))
.addEntry(`bitbag-${pluginName}-admin`, path.resolve(__dirname, `./src/Resources/assets/admin/entry.js`))
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.enableSassLoader();
const distConfig = Encore.getWebpackConfig();
distConfig.name = `bitbag-plugin-dist`;
Encore.reset();
const shopConfig = getConfig(pluginName, 'shop')
const adminConfig = getConfig(pluginName, 'admin')
module.exports = [shopConfig, adminConfig, distConfig];