From dbf19e363edddfe935f9619ccc81c382c640e88d Mon Sep 17 00:00:00 2001 From: Damien Foulhoux Date: Mon, 12 Aug 2024 16:22:17 +0200 Subject: [PATCH] fix webpack output --- index.html.twig | 6 +++--- webpack.config.js | 14 ++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/index.html.twig b/index.html.twig index 68ee362..7105507 100644 --- a/index.html.twig +++ b/index.html.twig @@ -24,21 +24,21 @@ {% set blocks = [ { - "image": encore_manifest_file("dist/images/placeholder.webp"), + "image": asset("dist/images/placeholder.webp"), alt: "Image desc", "title": "Ici une phrase d’accroche pour accompagner le visuel", "href": "#", "linkLabel": "Je découvre" }, { - "image": encore_manifest_file("dist/images/placeholder.webp"), + "image": asset("dist/images/placeholder.webp"), alt: "Image desc", "title": "Ici une phrase d’accroche pour accompagner le visuel", "href": "#", "linkLabel": "Je découvre" }, { - "image": encore_manifest_file("dist/images/placeholder.webp"), + "image": asset("dist/images/placeholder.webp"), alt: "Image desc", "title": "Ici une phrase d’accroche pour accompagner le visuel", "href": "#", diff --git a/webpack.config.js b/webpack.config.js index c8aae98..87b8bc7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,5 @@ const Encore = require('@symfony/webpack-encore'); -const path = require("path"); +const path = require('path'); // 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. @@ -14,7 +14,7 @@ Encore // public path used by the web server to access the output path //.setPublicPath('/templates/frontOffice/flexy/public/build') ///build .setPublicPath( - process.env.NODE_ENV === 'production' + Encore.isProduction() ? '/templates-assets/frontOffice/' + path.basename(__dirname) + '/dist' : '/dist' ) @@ -62,12 +62,9 @@ Encore .configureWatchOptions((config) => { config.ignored = /node_modules|dist/; }) - .configureDevServerOptions(options => { + .configureDevServerOptions((options) => { options.allowedHosts = 'all'; - }) - - - + }); // enables Sass/SCSS support //.enableSassLoader() @@ -84,9 +81,6 @@ Encore // uncomment if you're having problems with a jQuery plugin //.autoProvidejQuery() -; - - // IMAGES CONFIG Encore.copyFiles({