Files
SimfonyBasics/spa/webpack.config.js
2024-07-05 13:46:23 +02:00

19 lines
630 B
JavaScript

const webpack = require('webpack');
const Encore = require('@symfony/webpack-encore');
const HtmlWebpackPlugin = require('html-webpack-plugin');
Encore
.setOutputPath('public/')
.setPublicPath('/')
.cleanupOutputBeforeBuild()
.addEntry('app', './src/app.js')
.enablePreactPreset()
.enableSassLoader()
.enableSingleRuntimeChunk()
.addPlugin(new HtmlWebpackPlugin({ template: 'src/index.ejs', alwaysWriteToDisk: true }))
.addPlugin(new webpack.DefinePlugin({
'ENV_API_ENDPOINT': JSON.stringify(process.env.API_ENDPOINT),
}))
;
module.exports = Encore.getWebpackConfig();