Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source map error: request failed with status 404 Resource URL: http://{mywebsite}/js/app.js Source Map URL: bootstrap.js.map-laravel-Vue

While posting the posts i am getting the above error on web consol.

Source map error: request failed with status 404 Resource Resource URL: http://{mywebsite}/js/app.js Source Map URL: bootstrap.js.map

My resourcses/js/app.js looks like this

    [const app = new Vue({
    el: '#app',
    data: {
    msg: 'Update new Post:',
    content:'', 
    },
    methods:{
        addPost(){

            axios.post('myid.web/home/addPost', {
                content:this.content
            })
            .then(function(response){
                console.log(response);
            })
            .catch(function(error){
                console.log(error);
            });
        }
    }
});][1]

And the webpack.js looks like this

 let mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
   .sass('resources/assets/sass/app.scss', 'public/css');

My partially working output

And my error looks like this

like image 645
Biswas Sampad Avatar asked Apr 09 '18 05:04

Biswas Sampad


People also ask

How do I fix source map error request failed with status 404?

I had this error: Source map error: Error: "request failed with status 404 Resource URL: cdn.jsdelivr.net/npm/less Source Map URL: less. min. js. map" Your method fixed it.

What is source map error?

General source map error reporting js mentions a source map, and the source map URL tells us where to find the source map data (in this case, relative to the resource). The error tells us that the source map is not JSON data — so we're serving the wrong file.


1 Answers

I had the same issue and followed Biswas comment. Go to your webpack.mix.js and change

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');

to

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
    .sourceMaps();
like image 182
Christian Avatar answered Oct 21 '22 11:10

Christian