Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

How to find the good path for image with Webpack Encore and Symfony 4

$
0
0

I'm using Symfony 4.4 for a project and yesterday I deployed the project on my server. This is the first time I'm using the package webpack encore. Impossible to find the path for the images

This is the error message :

GET SERVERPATH/images/usersAvatar/5e685c89938b9522796974.jpeg 404 (Not Found)

This is my webpack.config.js file :

var Encore = require('@symfony/webpack-encore');
const CopyWebpackPlugin = require('copy-webpack-plugin');

if (!Encore.isRuntimeEnvironmentConfigured()) {
    Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

Encore
    .setOutputPath('public/build/')
    .setPublicPath('bui/build')
    .setManifestKeyPrefix('build/')


    .addEntry('app', './assets/js/app.js')

    .splitEntryChunks()

    .enableSingleRuntimeChunk()

    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())

    .configureBabelPresetEnv((config) => {
        config.useBuiltIns = 'usage';
        config.corejs = 3;
    })

    .addPlugin(new CopyWebpackPlugin([
        {from: './assets/static/', to: 'static'}
    ]))

    .autoProvidejQuery()
;

module.exports = Encore.getWebpackConfig();

Do you have an idea ?


Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>