This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/webpack.config.js

25 lines
674 B
JavaScript
Raw Permalink Normal View History

2019-12-09 12:00:00 +00:00
let Encore = require('@symfony/webpack-encore')
2020-03-10 13:10:06 +00:00
let purgecssConfig = require('./purgecss.config')
2019-12-09 12:00:00 +00:00
let PurgecssPlugin = require('purgecss-webpack-plugin')
2019-12-07 22:01:32 +00:00
Encore
2020-01-16 08:57:20 +00:00
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.setOutputPath('source/build/')
.setPublicPath('/build')
.addEntry('app', './assets/js/app.js')
.enablePostCssLoader()
2020-03-09 18:16:37 +00:00
.configureLoaderRule('css', loaderRule => {
2020-03-09 20:38:30 +00:00
loaderRule.test = /\.(css|p(ost)?css)$/
2020-03-09 18:16:37 +00:00
})
2019-12-07 22:01:32 +00:00
if (Encore.isProduction()) {
2020-03-11 21:44:41 +00:00
Encore
.enableVersioning()
.addPlugin(new PurgecssPlugin(purgecssConfig))
2020-03-14 18:57:33 +00:00
} else {
Encore.enableSourceMaps()
2019-12-07 22:01:32 +00:00
}
module.exports = Encore.getWebpackConfig()