Website/app/webpack.config.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-10-29 17:01:21 +00:00
2024-04-22 18:52:51 +00:00
const Encore = require('@symfony/webpack-encore');
const path = require('path');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
2023-10-29 17:01:21 +00:00
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
2024-04-22 18:52:51 +00:00
const ROOT_PATH = path.resolve(__dirname, './');
const ASSETS_PATH = ROOT_PATH + '/assets';
const ALIASES = {
'@src' : ASSETS_PATH,
'@packages' : ASSETS_PATH + '/packages',
'@controllers' : ASSETS_PATH + '/controllers',
'@styles' : ASSETS_PATH + '/styles'
};
2023-10-29 17:01:21 +00:00
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
2024-04-22 18:52:51 +00:00
.addAliases(ALIASES)
2023-10-29 17:01:21 +00:00
.addEntry('app', './assets/app.ts')
.enableStimulusBridge('./assets/controllers.json')
2024-04-22 18:52:51 +00:00
.splitEntryChunks()
2023-10-29 17:01:21 +00:00
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = '3.23';
})
.enableSassLoader()
.enableTypeScriptLoader()
2024-04-22 18:52:51 +00:00
.enableForkedTypeScriptTypesChecking()
2023-10-29 17:01:21 +00:00
;
module.exports = Encore.getWebpackConfig();