小编Tim*_*msy的帖子

Laravel 9.1 / Vite - 运行“NPM Run Dev”时出现“TypeError:laravel 不是函数”

我正在尝试使用 Vite 附带的 Laravel 9.1 构建一个 Web 应用程序,我个人以前从未使用过 Vite,所以我不太确定这个错误。

我似乎收到错误

TypeError: laravel is not a function
Run Code Online (Sandbox Code Playgroud)

每当我运行 npm run dev 时。运行构建时出现同样的错误。

下面我将发布我的 package.json 和 vite.config.js 文件。

包.json

{
    "type": "module",
    "private": true,
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "@vitejs/plugin-vue": "^2.3.3",
        "axios": "^1.1.2",
        "laravel-vite-plugin": "^0.7.1",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "vite": "^3.2.4"
    },
    "dependencies": {
        "got": "^11.8.3",
        "vue": "^3.2.36",
        "vue-loader": "^17.0.1"
    }
}

Run Code Online (Sandbox Code Playgroud)

vite.config.js

import laravel from 'laravel-vite-plugin'

import vue from '@vitejs/plugin-vue'

import { defineConfig } from 'vite' …
Run Code Online (Sandbox Code Playgroud)

javascript node.js npm laravel vite

2
推荐指数
1
解决办法
3122
查看次数

标签 统计

javascript ×1

laravel ×1

node.js ×1

npm ×1

vite ×1