Spookie/webpack.config.js

61 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-04-11 13:32:33 +02:00
const Encore = require('@symfony/webpack-encore');
2022-05-03 14:52:04 +02:00
const path = require("path");
const ManifestPlugin = require('webpack-manifest-plugin')
2021-06-01 18:48:20 +02:00
if (!Encore.isRuntimeEnvironmentConfigured()) {
2022-04-11 13:32:33 +02:00
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
2021-06-01 18:48:20 +02:00
}
Encore
2022-04-11 13:32:33 +02:00
.setOutputPath('public/build/')
2022-05-03 14:52:04 +02:00
.setPublicPath('/build')
2021-06-01 18:48:20 +02:00
.copyFiles({
from: "./assets/images",
to: "images/[path][name].[ext]"
})
2022-05-03 14:52:04 +02:00
/*
.copyFiles([
{from: './node_modules/ckeditor4/', to: 'ckeditor/[path][name].[ext]', pattern: /\.(js|css)$/, includeSubdirectories: false},
{from: './node_modules/ckeditor4/adapters', to: 'ckeditor/adapters/[path][name].[ext]'},
{from: './node_modules/ckeditor4/lang', to: 'ckeditor/lang/[path][name].[ext]'},
{from: './node_modules/ckeditor4/plugins', to: 'ckeditor/plugins/[path][name].[ext]'},
{from: './node_modules/ckeditor4/skins', to: 'ckeditor/skins/[path][name].[ext]'},
{from: './node_modules/ckeditor4/vendor', to: 'ckeditor/vendor/[path][name].[ext]'}
])
*/
2021-06-01 18:48:20 +02:00
2022-04-11 13:32:33 +02:00
2022-05-03 14:52:04 +02:00
.addEntry('app', './assets/js/app.js')
2022-04-11 13:32:33 +02:00
.splitEntryChunks()
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()
.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;
})
2021-06-01 18:48:20 +02:00
2022-05-03 14:52:04 +02:00
.addAliases({
'@': path.resolve(__dirname, 'assets', 'js'),
styles: path.resolve(__dirname, 'assets', 'styles'),
})
.enableSassLoader()
.enableVueLoader()
2021-06-01 18:48:20 +02:00
2022-04-11 13:32:33 +02:00
.autoProvidejQuery()
2021-06-01 18:48:20 +02:00
;
module.exports = Encore.getWebpackConfig();