logue / vue-codemirror6

⌨️ @codemirror 6 component for @vuejs. Vue2 & Vue3 both supported.
https://logue.dev/vue-codemirror6/
MIT License
143 stars 19 forks source link

how do I resolve “You may need an appropriate loader to handle this file type.” #45

Closed SeanCyberflow closed 4 months ago

SeanCyberflow commented 4 months ago

when I import the Component to my vue file encounter some error

in ./node_modules/vue-codemirror6/dist/index.es.js

Module parse failed: Unexpected token (24:123) You may need an appropriate loader to handle this file type. | }; | var ge = ie; | const le = (e) => e ? Object.entries(e).reduce((l, [i, u]) => (i = i.charAt(0).toUpperCase() + i.slice(1), i = on${i}, { ...l, [i]: u }), {}) : {}; | function B(e, l = {}, i) { | if (X)

@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/CodeMirror/index.vue 8:0-41 @ ./src/components/CodeMirror/index.vue @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/configCenter/bannerDiscover/index.vue @ ./src/views/configCenter/bannerDiscover/index.vue

I already switch node.js version -> v14.21.3 v16.0.0 v20.15.1

project package.json dependencies

"dependencies": { "@vue/composition-api": "^1.7.2", "axios": "^0.18.0", "echarts": "^5.3.2", "element-ui": "^2.15.5", "file-saver": "^2.0.5", "js-cookie": "^2.2.0", "js-md5": "^0.7.3", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "node-sass": "npm:sass@^1.71.1", "normalize.css": "^8.0.0", "nprogress": "^0.2.0", "qs": "^6.12.1", "sortablejs": "^1.15.2", "treedoc-viewer": "^0.1.71", "vue": "^2.5.2", "vue-codemirror6": "^1.3.2", "vue-router": "^3.0.7", "vuex": "^3.0.1", "vuex-persist": "^3.1.3", "wangeditor": "^4.7.2", "xlsx": "^0.16.9", "yaml-js": "^0.3.1", "yorkie": "^2.0.0" }, "devDependencies": { "@babel/eslint-parser": "^7.16.5", "@babel/preset-env": "^7.24.7", "autoprefixer": "^7.1.2", "babel-core": "^6.22.1", "babel-eslint": "^10.1.0", "babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-loader": "^7.1.1", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-runtime": "^6.22.0", "babel-plugin-transform-vue-jsx": "^3.5.0", "babel-preset-env": "^1.3.2", "babel-preset-stage-2": "^6.22.0", "chalk": "^2.0.1", "copy-webpack-plugin": "^4.0.1", "cross-env": "^7.0.3", "css-loader": "^0.28.0", "eslint": "^7.32.0", "eslint-config-alloy": "^3.10.0", "eslint-config-prettier": "^8.2.0", "eslint-plugin-vue": "^7.20.0", "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^1.1.4", "friendly-errors-webpack-plugin": "^1.6.1", "html-webpack-plugin": "^2.30.1", "lint-staged": "^12.3.1", "node-notifier": "^5.1.2", "optimize-css-assets-webpack-plugin": "^3.2.0", "ora": "^1.2.0", "portfinder": "^1.0.13", "postcss-import": "^11.0.0", "postcss-loader": "^2.0.8", "postcss-url": "^7.2.1", "rimraf": "^2.6.0", "sass-loader": "^7.0.1", "semver": "^5.3.0", "shelljs": "^0.7.6", "svg-sprite-loader": "^3.7.3", "uglifyjs-webpack-plugin": "^1.1.1", "url-loader": "^0.5.8", "vue-eslint-parser": "^7.11.0", "vue-loader": "^13.3.0", "vue-style-loader": "^3.0.1", "vue-template-compiler": "^2.5.2", "webpack": "^3.6.0", "webpack-bundle-analyzer": "^2.9.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^2.11.5", "webpack-merge": "^4.1.0" },

Is there any other information I need to provide?

logue commented 4 months ago

First, your version of vue2 may be outdated. We don't support 2.7.x or earlier. Also, support for Vue2 ended at the end of last year, so we cannot guarantee that it will work.

SeanCyberflow commented 4 months ago

First, your version of vue2 may be outdated. We don't support 2.7.x or earlier. Also, support for Vue2 ended at the end of last year, so we cannot guarantee that it will work.

ok,Thanks for your help.