How can I modify a Vue Loader setting in Laravel Mix?

869 views Asked by At

Using Laravel Mix by the way... and trying to use Vue Apollo, it says we need to add this to babel config:

        {
            test: /\.vue$/,
            use: [
                {
                    loader: 'vue-loader',
                    options: {
                        transpileOptions: {
                            transforms: {
                                dangerousTaggedTemplateString: true
                            }
                        }
                    }
                }
            ]
        },

but that is giving me Failed to mount component: template or render function not defined. error that I haven't been able to find a solution for, except for a thread somewhere in Google saying it's because I'm using vue-loader twice..

So, what I'm trying to do now that may fix this error is to apply that dangerousTaggedTemplateString setting to the existing webpack configuration for .vue files.

Anyone knows how to do that?

1

There are 1 answers

0
Dan On BEST ANSWER

Try this (untested), leave the mix.js line you mentioned untouched. Then on a new line:

mix.options({
   vue: {
      transpileOptions: {
         transforms: {
            dangerousTaggedTemplateString: true
         }
      }
   }
});