FareedR's avatar

change require to public path in laravel mix ( react js )

how can i change from require to public path , because when i change it , path doesnt right ..

// in component file
<img src={require('../../../images/fire.png')} style={{ width: "110px", height: "110px", float: "none", margin:"0 auto", display:"block", marginTop:"60px"}} />

// webpack.mix.js
mix.react(['resources/assets/js/app.js'],'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .styles([
        'resources/assets/css/animate.css',
    ],'public/css/all.css')
    .webpackConfig({
        output: {
            publicPath: '/',
            chunkFilename: `generated/chunks/[name]${mix.config.inProduction ? '.[chunkhash].chunk.js' : '.chunk.js'}`,
        }
    });
0 likes
1 reply
jlrdw's avatar

Is this something unique to mix. I always use a url to display an image.

<img src="{{ asset('assets/upload/imgdogs') . '/' . $row->dogpic }}" alt="" class="image">

Sorry if I misunderstood question.

Please or to participate in this conversation.