-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
38 lines (29 loc) · 1.17 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
const path = require('path');
const Encore = require('@symfony/webpack-encore');
const pluginName = 'product-samples';
const getConfig = (pluginName, type) => {
Encore.reset();
Encore
.setOutputPath(`public/build/babdev/${pluginName}/${type}/`)
.setPublicPath(`/build/babdev/${pluginName}/${type}/`)
.addEntry(`babdev-${pluginName}-${type}`, path.resolve(__dirname, `./src/Resources/assets/${type}/entry.js`))
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableSassLoader();
const config = Encore.getWebpackConfig();
config.name = `babdev-${pluginName}-${type}`;
return config;
}
Encore
.setOutputPath('src/Resources/public/')
.setPublicPath('/public/')
.addEntry(`babdev-${pluginName}-shop`, path.resolve(__dirname, './src/Resources/assets/shop/entry.js'))
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.enableSassLoader();
const distConfig = Encore.getWebpackConfig();
distConfig.name = 'product-samples-plugin-dist';
Encore.reset();
const shopConfig = getConfig(pluginName, 'shop')
module.exports = [shopConfig, distConfig];