Updated webpack-encore recipe.

This commit is contained in:
Jan Böhmer 2021-10-02 21:23:34 +02:00
parent 9ae8e55b9e
commit ae67b55bf1
7 changed files with 45 additions and 24 deletions

View file

@ -57,9 +57,10 @@ Encore
* and one CSS file (e.g. app.css) if you JavaScript imports CSS.
*/
.addEntry('app', './assets/js/app.js')
.addEntry('ru2ftwofactor', './assets/js/u2f_auth.js')
//.addEntry('ajaxUI', './assets/ts_src/ajax_ui.ts')
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
//.addEntry('page1', './assets/js/page1.js')
//.addEntry('page2', './assets/js/page2.js')
@ -83,6 +84,10 @@ Encore
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
.configureBabel((config) => {
config.plugins.push('@babel/plugin-proposal-class-properties');
})
// enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
@ -94,9 +99,12 @@ Encore
// uncomment if you use TypeScript
.enableTypeScriptLoader()
// uncomment if you're having problems with a jQuery plugin
.autoProvidejQuery()
// uncomment if you use React
//.enableReactPreset()
// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
.enableIntegrityHashes(Encore.isProduction())
.addPlugin(new CopyPlugin([
{
from: 'node_modules/bootswatch/dist/*/*.min.css',
@ -109,9 +117,9 @@ Encore
}
]))
// uncomment if you use API Platform Admin (composer req api-admin)
//.enableReactPreset()
//.addEntry('admin', './assets/js/admin.js')
// uncomment if you're having problems with a jQuery plugin
.autoProvidejQuery()
;
if (Encore.isProduction()) {