Upgrade recipes: symfony/webpack-encore-bundle

This commit is contained in:
Julien Fastré 2023-09-06 12:54:47 +02:00
parent ca5f69b911
commit 7f1ee500a0
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
7 changed files with 35 additions and 24 deletions

2
assets/bootstrap.js vendored
View File

@ -4,7 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge';
export const app = startStimulusApp(require.context( export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers', '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true, true,
/\.(j|t)sx?$/ /\.[jt]sx?$/
)); ));
// register any custom, 3rd party controllers here // register any custom, 3rd party controllers here

View File

@ -1,3 +0,0 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

View File

@ -1,4 +0,0 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

View File

@ -1,2 +0,0 @@
webpack_encore:
strict_mode: false

View File

@ -1,16 +1,18 @@
---
webpack_encore: webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath() # The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build' output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build: # If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false # output_path: false
# Set attributes that will be rendered on all script and link tags # Set attributes that will be rendered on all script and link tags
script_attributes: script_attributes:
defer: true defer: true
# Uncomment (also under link_attributes) if using Turbo Drive
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
# 'data-turbo-track': reload
# link_attributes: # link_attributes:
# # Uncomment if using Turbo Drive
# 'data-turbo-track': reload
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials') # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous' # crossorigin: 'anonymous'
@ -23,11 +25,17 @@ webpack_encore:
# If you have multiple builds: # If you have multiple builds:
# builds: # builds:
# pass "frontend" as the 3rg arg to the Twig functions # pass the build name as the 3rd argument to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }} # {{ encore_entry_script_tags('entry1', null, 'frontend') }}
# frontend: '%kernel.project_dir%/public/frontend/build' # frontend: '%kernel.project_dir%/public/frontend/build'
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) #when@prod:
# Put in config/packages/prod/webpack_encore.yaml # webpack_encore:
# cache: true # # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# # Available in version 1.2
# cache: true
#when@test:
# webpack_encore:
# strict_mode: false

View File

@ -785,12 +785,12 @@
] ]
}, },
"symfony/webpack-encore-bundle": { "symfony/webpack-encore-bundle": {
"version": "1.9", "version": "1.17",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "master", "branch": "main",
"version": "1.9", "version": "1.10",
"ref": "9399a0bfc6ee7a0c019f952bca46d6a6045dd451" "ref": "eff2e505d4557c967b6710fe06bd947ba555cae5"
}, },
"files": [ "files": [
"assets/app.js", "assets/app.js",
@ -798,9 +798,6 @@
"assets/controllers.json", "assets/controllers.json",
"assets/controllers/hello_controller.js", "assets/controllers/hello_controller.js",
"assets/styles/app.css", "assets/styles/app.css",
"config/packages/assets.yaml",
"config/packages/prod/webpack_encore.yaml",
"config/packages/test/webpack_encore.yaml",
"config/packages/webpack_encore.yaml", "config/packages/webpack_encore.yaml",
"package.json", "package.json",
"webpack.config.js" "webpack.config.js"

View File

@ -109,15 +109,30 @@ module.exports = (async () => {
.autoProvidejQuery() .autoProvidejQuery()
.enableSourceMaps(!Encore.isProduction()) .enableSourceMaps(!Encore.isProduction())
.cleanupOutputBeforeBuild() .cleanupOutputBeforeBuild()
//.enableBuildNotifications()
.enableVersioning() .enableVersioning()
.enableSingleRuntimeChunk() .enableSingleRuntimeChunk()
.splitEntryChunks() .splitEntryChunks()
// added when upgrading to symfony 5.4
// enables and configure @babel/preset-env polyfills
//.configureBabelPresetEnv((config) => {
// config.useBuiltIns = 'usage';
// config.corejs = '3.23';
//})
//.addLoader({ test: /\.pdf$/, loader: 'file-loader', options: { name: '[name]_[hash].[ext]', outputPath: 'pdf/' } }) //.addLoader({ test: /\.pdf$/, loader: 'file-loader', options: { name: '[name]_[hash].[ext]', outputPath: 'pdf/' } })
; ;
// populate config with chill entries // populate config with chill entries
let chillEntries = []; let chillEntries = [];
await populateConfig(Encore, chillEntries); await populateConfig(Encore, chillEntries);
// configure Babel
// .configureBabel((config) => {
// config.plugins.push('@babel/a-babel-plugin');
// })
// enables Sass/SCSS support
//.enableSassLoader()
// add swagger UI // add swagger UI
if (!Encore.isProduction()) { if (!Encore.isProduction()) {