Spookie/webpack.config.js
2022-11-10 13:48:29 +01:00

48 lines
1.4 KiB
JavaScript

const Encore = require('@symfony/webpack-encore')
const path = require('path')
//const ManifestPlugin = require('webpack-manifest-plugin')
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev')
}
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.copyFiles({
from: './assets/images',
to: 'images/[path][name].[ext]'
})
.addEntry('app', './assets/app.js')
.splitEntryChunks()
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
.enableVersioning(Encore.isProduction())
.configureBabel((config) => {
config.plugins.push('@babel/plugin-proposal-class-properties')
})
// enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage'
config.corejs = 3
})
.addAliases({
'@': path.resolve(__dirname, 'assets', 'js'),
styles: path.resolve(__dirname, 'assets', 'styles')
})
.enableSassLoader()
.enableTypeScriptLoader()
.enablePostCssLoader((options) => {
options.postcssOptions = {
// directory where the postcss.config.js file is stored
path: './postcss.config.js'
}
})
.autoProvidejQuery()
module.exports = Encore.getWebpackConfig()