49 lines
1.5 KiB
JavaScript
Executable File
49 lines
1.5 KiB
JavaScript
Executable File
var Encore = require('@symfony/webpack-encore');
|
|
const glob = require('glob');
|
|
// Manually configure the runtime environment if not already configured yet by the "encore" command.
|
|
// It's useful when you use tools that rely on webpack.config.js file.
|
|
if (!Encore.isRuntimeEnvironmentConfigured()) {
|
|
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
|
|
}
|
|
|
|
function getEntries (){
|
|
return glob.sync("./var/plugins/System/**/*/Webpack/index.{js,ts}");
|
|
}
|
|
|
|
Encore
|
|
.setOutputPath('web/build/')
|
|
.setPublicPath('/apps/build')
|
|
.setManifestKeyPrefix('/apps')
|
|
|
|
.addEntry('backend/dashboard', './assets/backend/dashboard/dashboard.js')
|
|
.copyFiles({
|
|
from: './assets/images',
|
|
to: 'images/[path][name].[ext]',
|
|
})
|
|
.splitEntryChunks()
|
|
|
|
.enableSingleRuntimeChunk()
|
|
|
|
.cleanupOutputBeforeBuild()
|
|
.enableBuildNotifications()
|
|
.enableSourceMaps(!Encore.isProduction())
|
|
.enableVersioning(Encore.isProduction())
|
|
|
|
.configureBabelPresetEnv((config) => {
|
|
config.useBuiltIns = 'usage';
|
|
config.corejs = 3;
|
|
})
|
|
// .enablePostCssLoader()
|
|
.enableSassLoader()
|
|
.enableStimulusBridge('./assets/controllers.json')
|
|
.enableLessLoader()
|
|
.enableTypeScriptLoader()
|
|
;
|
|
for (const entry of getEntries()) {
|
|
console.log(entry);
|
|
const splEntry = entry.split('/');
|
|
Encore.addEntry('plugins/' + splEntry[3].toLowerCase() + '/' + splEntry[4].toLowerCase() + '/' + splEntry[5].toLowerCase(), entry);
|
|
}
|
|
|
|
module.exports = Encore.getWebpackConfig();
|