-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·28 lines (21 loc) · 1.02 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
const Encore = require('@symfony/webpack-encore'),
LiveReloadPlugin = require('webpack-livereload-plugin');
Encore
.setOutputPath('./public/wp-content/themes/custom/dist/')
.setPublicPath('/wp-content/themes/custom/dist')
.addEntry('js/app', './assets/js/_app.js')
.autoProvidejQuery()
.addStyleEntry('css/app', './assets/scss/_app.scss')
.enableSassLoader()
.enablePostCssLoader(() => ({plugins: [require('autoprefixer')]}))
.copyFiles([{ from: './assets/images', to: 'images/[path][name].[ext]' }])
.configureTerserPlugin(options => options.extractComments = true)
.cleanupOutputBeforeBuild()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.disableSingleRuntimeChunk()
;
const config = Encore.getWebpackConfig();
config.watchOptions = {poll: 1000, ignored: /node_modules/}; // Limit file updates for Docker
if (!config.devServer) config.plugins.push(new LiveReloadPlugin()); // Add LiveReload when no dev server
module.exports = config;