반응형
vuejs + babel-intered 이거.setDynamic은 함수가 아닙니다.
코드에 문제가 있습니다.larabel-mix Web pack 설정에 babel-loader를 추가하려고 하는데 오류가 발생하였습니다.setDynamic은 함수가 아닙니다.
이것은 webapack-mix.js 파일입니다.
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')
dev-server 실행 시 이 오류가 발생하였습니다.
그것에 대한 해결책을 가진 사람이 있나요?인터넷으로 많이 찾아봤지만 아무 것도 되지 않는다.
Larabel 5.4.x에서도 같은 문제가 발생하여 모듈 버전 전환 시도 및 오류 발생 후 문제를 해결할 수 있었습니다.
패키지.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"@babel/core": "^7.1.2",
"axios": "^0.16.2",
"babel-loader": "^7.1.5",
"babel-plugin-dynamic-import-webpack": "^1.1.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-es2015": "^6.24.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"css-loader": "^0.28.11",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.10",
"vue": "^2.5.22",
"vue-loader": "^13.7.3",
"vue-style-loader": "^3.1.2",
"vue-template-compiler": "^2.5.22"
},
"dependencies": {
"vee-validate": "^2.1.0-beta.1",
"vue-click-outside": "^1.0.7",
"vue-content-loading": "^1.5.3",
"vue-multiselect": "^2.1.3",
"yarn": "^1.9.4"
}
}
webpack.webpack.webpack.m
let mix = require('laravel-mix');
/**
* Override Laravel Mix Webpack Configuration
* @type {{chunkFilename: string, publicPath: string}}
*/
mix.config.webpackConfig.output = {
chunkFilename: 'js/[name].bundle.js',
publicPath: '/',
};
mix.js('resources/assets/js/app.js', 'public/js')
.babelrc
{
"presets": [
[
"es2015",
{
"modules": false
}
]
],
"plugins": ["syntax-dynamic-import"]
}
언급URL : https://stackoverflow.com/questions/52901717/vuejs-babel-loader-this-setdynamic-is-not-a-function
반응형
'IT이야기' 카테고리의 다른 글
Vue js의 Firebase에서 토큰을 검색하는 동안 오류가 발생하는 이유는 무엇입니까? (0) | 2022.06.03 |
---|---|
Nuxt SSR 인증 가드 및 Firebase 인증 (0) | 2022.06.03 |
Nuxt 저장소 변환이 TypeError를 수신했습니다. (0) | 2022.06.03 |
대부분의 C개발자가 const 대신 정의를 사용하는 이유는 무엇입니까? (0) | 2022.06.02 |
Laravel에서 Vue.js를 운영 모드로 전환하는 방법 (0) | 2022.06.02 |