Spookie/webpack.config.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

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