H
H
Hanry6542020-09-30 23:37:34
Vue.js
Hanry654, 2020-09-30 23:37:34

External commonjs vue_commonjs2_vue_root, what to do?

Installed vue-email-editor and copied the example from github:

<template>
  <div class="container">
    <div id="bar">
      <h1>Vue Email Editor (Demo)</h1>

      <button @click="saveDesign">Save Design</button>
      <button @click="exportHtml">Export HTML</button>
    </div>

    <EmailEditor ref="editor" @load="editorLoaded" />
  </div>
</template>

<script>
import { EmailEditor } from 'vue-email-editor'
  
export default {
  components: {
    EmailEditor
  },
  methods: {
    editorLoaded() {
      this.$refs.editor.loadDesign({});
    },
    saveDesign() {
      this.$refs.editor.saveDesign(
        (design) => {
          console.log('saveDesign', design);
        }
      )
    },
    exportHtml() {
      this.$refs.editor.exportHtml(
        (data) => {
          console.log('exportHtml', data);
        }
      )
    }
  }
}
</script>

But in the console it gives an error:
Uncaught TypeError: external_commonjs_vue_commonjs2_vue_root_Vue_default.a is undefined

package.json
{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "bootstrap": "^4.5.2",
    "core-js": "^3.6.5",
    "md5": "^2.3.0",
    "vue": "^3.0.0-0",
    "vue-email-editor": "^0.7.2",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0-0",
    "@vue/eslint-config-prettier": "^6.0.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-vue": "^7.0.0-0",
    "jquery": "^3.5.1",
    "lint-staged": "^9.5.0",
    "node-sass": "^4.12.0",
    "popper.js": "^1.16.1",
    "prettier": "^1.19.1",
    "sass-loader": "^8.0.2"
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question