I have some problems with my code. I'm trying to add babel-loader to my laravel-mix webpack's config, but I get an error telling me that this.setDynamic is not a function.
This is my webapack-mix.js file
const {mix} = require('laravel-mix');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.webpackConfig({
module: {
rules: [
// We're registering the TypeScript loader here. It should only
// apply when we're dealing with a `.ts` or `.tsx` file.
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {appendTsSuffixTo: [/\.vue$/]},
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ["@babel/plugin-transform-runtime"],
}
},
}
],
},
plugins: [
// make sure to include the plugin!
new VueLoaderPlugin()
],
resolve: {
// We need to register the `.ts` extension so Webpack can resolve
// TypeScript modules without explicitly providing an extension.
// The other extensions in this list are identical to the Mix
// defaults.
extensions: ['*', '.jsx', '.vue', '.ts', '.tsx', '.js'],
},
});
mix.sass('resources/sass/app.scss', 'public/css')
.sass('resources/sass/admin.scss', 'public/css')
.ts('resources/js/src/app.ts', 'public/js')
.ts('resources/js/src/Admin/admin.ts', 'public/js')
And when I run my dev-server I got this error
Does anyone have a solution for that? I did a lot of research on the internet but nothing works