Website/app/webpack.config.js
Snoweuph 651df3b0f1
All checks were successful
Quality Check / QS Backend (push) Successful in 20s
Quality Check / QS Mixed (push) Successful in 32s
Quality Check / QS Frontend (push) Successful in 38s
#1: QS Workflow
2024-07-13 21:25:44 +02:00

62 lines
1.6 KiB
JavaScript

const Encore = require('@symfony/webpack-encore');
const {TsconfigPathsPlugin} = require("tsconfig-paths-webpack-plugin");
const path = require('path');
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
const TS_CONFIG_PATH = path.resolve("frontend/tsconfig.json")
Encore
// Paths and Files
.setOutputPath('public/build/')
.setPublicPath('/build')
.copyFiles({
from: './assets/',
to: '../[path][name].[ext]',
pattern: /\.(?!scss|stylelint.*|json|woff).*$/
})
// Code Entries
.addEntry('app', './frontend/app.ts')
// Style Entries
//.addStyleEntry('name', './frontend/styles/name.scss')
// Webpack
.splitEntryChunks()
.enableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
// Packages
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = '3.23';
})
.enableStimulusBridge('./frontend/controllers.json')
.enableSassLoader()
.enableTypeScriptLoader(function tsconfigCallback(tsConfig) {
tsConfig.configFile = TS_CONFIG_PATH;
})
.enableForkedTypeScriptTypesChecking(function (forkedTsConfig) {
forkedTsConfig.typescript = {
configFile: TS_CONFIG_PATH
}
})
;
const config = Encore.getWebpackConfig();
config.resolve.plugins = [
new TsconfigPathsPlugin({
configFile: TS_CONFIG_PATH,
})
];
module.exports = config;