const Encore = require('@symfony/webpack-encore'); const path = require('path'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); if (!Encore.isRuntimeEnvironmentConfigured()) { Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); } 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' }; Encore .setOutputPath('public/build/') .setPublicPath('/build') .addAliases(ALIASES) .addEntry('app', './assets/app.ts') .enableStimulusBridge('./assets/controllers.json') .splitEntryChunks() .enableSingleRuntimeChunk() .cleanupOutputBeforeBuild() .enableBuildNotifications() .enableSourceMaps(!Encore.isProduction()) .enableVersioning(Encore.isProduction()) .configureBabelPresetEnv((config) => { config.useBuiltIns = 'usage'; config.corejs = '3.23'; }) .enableSassLoader() .enableTypeScriptLoader() .enableForkedTypeScriptTypesChecking() ; module.exports = Encore.getWebpackConfig();