Skip to content

(void 0) is not a function #9

Open
@542154968

Description

@542154968

依赖

{
  "name": "computing-platform",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "sea": "vite --mode sea",
    "build": "vue-tsc --noEmit && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@element-plus/icons-vue": "^2.0.9",
    "@types/node": "^18.7.15",
    "axios": "^0.27.2",
    "blockly": "^8.0.5",
    "element-plus": "^2.2.16",
    "mavon-editor": "^3.0.0-beta",
    "monaco-editor": "^0.34.0",
    "vue": "^3.2.37",
    "vue-router": "^4.1.5"
  },
  "devDependencies": {
    "@iconify-json/ep": "^1.1.7",
    "@vitejs/plugin-vue": "^3.0.3",
    "sass": "^1.54.8",
    "sass-loader": "^13.0.2",
    "typescript": "^4.6.4",
    "unplugin-auto-import": "^0.11.2",
    "unplugin-icons": "^0.14.9",
    "unplugin-vue-components": "^0.22.4",
    "vite": "^3.0.7",
    "vite-plugin-html": "^3.2.0",
    "vite-plugin-monaco-editor-nls": "^2.0.2",
    "vue-tsc": "^0.39.5"
  }
}

配置

import { defineConfig } from "vite";
import { loadEnv } from "vite";
import zh_CN from "./src/plugins/monaco-editor/vscode-language-pack-zh-hans/main.i18n.json";

import MonacoEditorNlsPlugin, {
  esbuildPluginMonacoEditorNls,
  Languages,
} from "vite-plugin-monaco-editor-nls";



// https://vitejs.dev/config/
export default ({ mode }) => {
  const env = loadEnv(mode, process.cwd());
  return defineConfig({
    base: "./",
  
    optimizeDeps: {
      /** vite 版本需要大于等于2.3.0 */
      esbuildOptions: {
        plugins: [
          esbuildPluginMonacoEditorNls({
            locale: Languages.zh_hans,
            /**
             * The weight of `localedata` is higher than that of `locale`
             */
            localeData: zh_CN.contents,
          }),
        ],
      },
    },
    
    plugins: [
      MonacoEditorNlsPlugin.default({
        locale: Languages.zh_hans,
        /**
         * The weight of `localedata` is higher than that of `locale`
         */
        localeData: zh_CN.contents,
      }),
    ],
    
    
  });
};

报错

image

vue-router.mjs:3441 TypeError: (void 0) is not a function
    at node_modules/monaco-editor/esm/vs/base/common/platform.js (platform.js:41:34)
    at __init (chunk-MB5FDF5C.js?v=3fbab092:9:56)
    at editorOptions.js:6:1

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions