Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
// Hint: if something doesn't work as expected: yarn upgrade --latest
|
||||
|
||||
var Encore = require('@symfony/webpack-encore');
|
||||
var webpack = require('webpack');
|
||||
const Encore = require('@symfony/webpack-encore');
|
||||
|
||||
Encore
|
||||
.setOutputPath('public/build/')
|
||||
.setPublicPath('build/')
|
||||
.setPublicPath('/build/')
|
||||
.setManifestKeyPrefix('build/')
|
||||
.cleanupOutputBeforeBuild()
|
||||
|
||||
.addEntry('app', './assets/app.js')
|
||||
.addEntry('export-pdf', './assets/export-pdf.js')
|
||||
.addEntry('invoice', './assets/invoice.js')
|
||||
.addEntry('invoice-pdf', './assets/invoice-pdf.js')
|
||||
.addEntry('chart', './assets/chart.js')
|
||||
.addEntry('calendar', './assets/calendar.js')
|
||||
.copyFiles({ from: './assets/images', to: 'images/[path][name].[ext]' })
|
||||
.addEntry('dashboard', './assets/dashboard.js')
|
||||
|
||||
.splitEntryChunks()
|
||||
.configureSplitChunks(function(splitChunks) {
|
||||
splitChunks.chunks = 'async';
|
||||
})
|
||||
|
||||
// bug: empty hashes in entrypoints.json
|
||||
//.enableIntegrityHashes(Encore.isProduction())
|
||||
|
||||
// in the past there was a bug with empty hashes in entrypoints.json, disable if it happens again
|
||||
.enableIntegrityHashes(Encore.isProduction())
|
||||
.enableSingleRuntimeChunk()
|
||||
.enableVersioning(Encore.isProduction())
|
||||
.enableSourceMaps(!Encore.isProduction())
|
||||
@@ -33,39 +32,31 @@ Encore
|
||||
resolveUrlLoader: false
|
||||
})
|
||||
|
||||
// to rewrite the font url() in CSS to be relative.
|
||||
// https://github.com/symfony/webpack-encore/issues/915#issuecomment-827556896
|
||||
.configureFontRule(
|
||||
{ type: 'javascript/auto' },
|
||||
(rule) => {
|
||||
rule.loader = 'file-loader';
|
||||
rule.options = { outputPath: 'fonts', name: '[name].[hash:8].[ext]', publicPath: './fonts/' };
|
||||
}
|
||||
)
|
||||
|
||||
.configureImageRule(
|
||||
{ type: 'javascript/auto' },
|
||||
(rule) => {
|
||||
rule.loader = 'file-loader';
|
||||
rule.options = { outputPath: 'images', name: '[name].[hash:8].[ext]', publicPath: './images/' };
|
||||
}
|
||||
)
|
||||
|
||||
.autoProvidejQuery()
|
||||
|
||||
// prevent that unused moment locales will be included
|
||||
.addPlugin(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
|
||||
|
||||
.configureBabel(null, {
|
||||
useBuiltIns: 'usage',
|
||||
corejs: 3,
|
||||
})
|
||||
|
||||
.configureCssMinimizerPlugin((options) => {
|
||||
options.minimizerOptions = {
|
||||
preset: ['default', { discardComments: { removeAll: true } }],
|
||||
}
|
||||
})
|
||||
|
||||
// compress javascript in production build
|
||||
.configureTerserPlugin((options) => {
|
||||
options.terserOptions = {
|
||||
compress: true,
|
||||
output: {
|
||||
comments: false,
|
||||
},
|
||||
// chart.js will fail if sources are mangled
|
||||
/*
|
||||
mangle: {
|
||||
properties: {
|
||||
regex: /^_/,
|
||||
},
|
||||
},
|
||||
*/
|
||||
}
|
||||
})
|
||||
|
||||
.enableEslintPlugin()
|
||||
;
|
||||
|
||||
module.exports = Encore.getWebpackConfig();
|
||||
|
||||
Reference in New Issue
Block a user