2019-06-03 01:43:49 +02:00
|
|
|
// Hint: if something doesn't work as expected: yarn upgrade --latest
|
|
|
|
|
2018-02-01 22:26:19 +01:00
|
|
|
var Encore = require('@symfony/webpack-encore');
|
2019-04-29 01:48:27 +02:00
|
|
|
var webpack = require('webpack');
|
2018-02-01 22:26:19 +01:00
|
|
|
|
|
|
|
Encore
|
|
|
|
.setOutputPath('public/build/')
|
2019-06-03 01:43:49 +02:00
|
|
|
.setPublicPath('build/')
|
2019-03-12 01:02:42 +01:00
|
|
|
.setManifestKeyPrefix('build/')
|
2018-02-01 22:26:19 +01:00
|
|
|
.cleanupOutputBeforeBuild()
|
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
.addEntry('app', './assets/app.js')
|
2020-03-06 03:21:39 +01:00
|
|
|
.addEntry('invoice', './assets/invoice.js')
|
2020-05-10 16:19:59 +02:00
|
|
|
.addEntry('invoice-pdf', './assets/invoice-pdf.js')
|
2019-06-03 01:43:49 +02:00
|
|
|
.addEntry('chart', './assets/chart.js')
|
|
|
|
.addEntry('calendar', './assets/calendar.js')
|
|
|
|
.copyFiles({ from: './assets/images', to: 'images/[path][name].[ext]' })
|
2018-02-01 22:26:19 +01:00
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
.splitEntryChunks()
|
|
|
|
.enableSingleRuntimeChunk()
|
|
|
|
.enableIntegrityHashes()
|
2018-02-01 22:26:19 +01:00
|
|
|
.enableVersioning(Encore.isProduction())
|
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
.enableSourceMaps(!Encore.isProduction())
|
2018-02-01 22:26:19 +01:00
|
|
|
.enableBuildNotifications()
|
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
.enableSassLoader()
|
2018-02-01 22:26:19 +01:00
|
|
|
.autoProvidejQuery()
|
|
|
|
|
2020-05-10 16:19:59 +02:00
|
|
|
// prevent that unused moment locales will be included
|
2019-06-03 01:43:49 +02:00
|
|
|
.addPlugin(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
|
|
|
|
|
|
|
.configureBabel(null, {
|
|
|
|
useBuiltIns: 'usage',
|
|
|
|
corejs: 3,
|
2018-02-01 22:26:19 +01:00
|
|
|
})
|
2018-02-03 17:52:26 +01:00
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
.configureOptimizeCssPlugin((options) => {
|
|
|
|
options.cssProcessorPluginOptions = {
|
|
|
|
preset: ['default', { discardComments: { removeAll: true } }],
|
|
|
|
}
|
|
|
|
})
|
2019-04-29 01:48:27 +02:00
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
.configureTerserPlugin((options) => {
|
|
|
|
options.cache = true;
|
|
|
|
options.terserOptions = {
|
|
|
|
output: {
|
|
|
|
comments: false
|
|
|
|
}
|
|
|
|
}
|
2018-02-03 17:52:26 +01:00
|
|
|
})
|
2018-02-01 22:26:19 +01:00
|
|
|
;
|
|
|
|
|
2019-06-03 01:43:49 +02:00
|
|
|
var config = Encore.getWebpackConfig();
|
|
|
|
|
|
|
|
// this is a hack based on https://github.com/symfony/webpack-encore/issues/88
|
|
|
|
// to rewrite the font url() in CSS to be relative.
|
|
|
|
// if you encounter any problems ... please let me know!
|
|
|
|
config.module.rules[3].options.publicPath = './';
|
|
|
|
|
|
|
|
module.exports = config;
|