源映射错误:请求失败,状态为 404 资源 URL:http://{mywebsite}/js/app.js 源映射 URL:bootstrap.js.map-laravel-Vue

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49726204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 17:36:54  来源:igfitidea点击:

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

javascriptlaravelvue.js

提问by Biswas Sampad

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

源映射错误:请求失败,状态为 404 资源资源 URL:http://{mywebsite}/js/app.js 源映射 URL:bootstrap.js.map

My resourcses/js/app.js looks like this

我的 resourcses/js/app.js 看起来像这样

    [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

webpack.js 看起来像这样

 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

我的错误看起来像这样

回答by Christian

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

我遇到了同样的问题,并遵循了 Biswas 的评论。转到您的 webpack.mix.js 并更改

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();