Giter VIP home page Giter VIP logo

Comments (8)

Falke-Design avatar Falke-Design commented on June 15, 2024

Can you please try to import the minified version import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.min.js"

from leaflet-geoman.

xiyuvi avatar xiyuvi commented on June 15, 2024

Can you please try to import the minified version import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.min.js"
Thank you for your help. After making the necessary changes, I still reported an error

// import "@geoman-io/leaflet-geoman-free";
import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.min.js"

Error content


 ERROR  Failed to compile with 1 error                                                                          17:55:13
 error  in ./node_modules/.store/@[email protected]/node_modules/@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.min.js

Module parse failed: Unexpected token (1:4153)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> (()=>{var ql=Object.create;var Kr=Object

My package.json file is as follows

{
  "name": "test",
  "scripts": {
    "dev": "vue-cli-service serve",
    "build:prod": "vue-cli-service build",
    "preview": "node build/index.js --preview",
    "lint": "eslint --ext .js,.vue src"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.{js,vue}": [
      "eslint --fix",
      "git add"
    ]
  },
  "keywords": [
    "vue",
  ],
  "dependencies": {
    "@geoman-io/leaflet-geoman-free": "2.16.0",
    "@jiaminghi/data-view": "^2.10.0",
    "@riophae/vue-treeselect": "0.4.0",
    "@turf/turf": "^6.5.0",
    "axios": "0.21.0",
    "clipboard": "2.0.6",
    "core-js": "^3.22.5",
    "docx-preview": "0.1.20",
    "echarts": "^5.3.3",
    "echarts-gl": "^2.0.9",
    "element-resize-detector": "^1.2.2",
    "element-ui": "2.15.13",
    "file-saver": "2.0.4",
    "flv.js": "^1.6.2",
    "fuse.js": "6.4.3",
    "highlight.js": "9.18.5",
    "jquery": "^3.6.0",
    "js-beautify": "1.13.0",
    "js-cookie": "2.2.1",
    "jsencrypt": "3.0.0-rc.1",
    "leaflet": "^1.9.4",
    "leaflet-polylinedecorator": "^1.6.0",
    "leaflet.markercluster": "^1.5.3",
    "leaflet.pm": "^2.2.0",
    "nprogress": "0.2.0",
    "qs": "^6.11.2",
    "quill": "1.3.7",
    "screenfull": "5.0.2",
    "sortablejs": "1.10.2",
    "terraformer-wkt-parser": "^1.2.1",
    "v-viewer": "^1.6.4",
    "vue": "^2.7.14",
    "vue-amap": "^0.5.10",
    "vue-count-to": "1.0.13",
    "vue-cropper": "0.5.5",
    "vue-json-excel": "^0.3.0",
    "vue-router": "3.4.9",
    "vue2-teleport": "^1.0.1",
    "vuedraggable": "2.24.3",
    "vuex": "3.6.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "4.4.6",
    "@vue/cli-plugin-eslint": "4.4.6",
    "@vue/cli-service": "4.4.6",
    "babel-eslint": "10.1.0",
    "chalk": "4.1.0",
    "connect": "3.6.6",
    "eslint": "7.15.0",
    "eslint-plugin-vue": "7.2.0",
    "lint-staged": "10.5.3",
    "runjs": "4.4.2",
    "sass": "~1.52.3",
    "sass-loader": "10.1.0",
    "script-ext-html-webpack-plugin": "2.1.5",
    "svg-sprite-loader": "5.1.1",
    "vue-template-compiler": "2.6.12"
  },
  "engines": {
    "node": ">=8.9",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}


babel.config.js
 module.exports = {
  presets: [
    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
    '@vue/cli-plugin-babel/preset'
  ],
  'env': {
    'development': {
      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
      'plugins': ['dynamic-import-node']
    }
  }
}

I want to know why this old project is not compatible with the new version, and how I can find a way to be compatible with the new version. God bless you

from leaflet-geoman.

Falke-Design avatar Falke-Design commented on June 15, 2024

Your problem is, that you ECMAScript Version doesn't understand the optional chaining ?. syntax. This has changed with the latest release, but we are not able to change this for you.

I suggest you to update your bundler and libraries, then you should be able to compile again.

Not releated to this issue, but you should remove leaflet.pm from your package.json. "leaflet.pm": "^2.2.0",

from leaflet-geoman.

xiyuvi avatar xiyuvi commented on June 15, 2024

Thank you, does my compiler support it Grammar, I have also extensively used this grammar in the project, and I am not sure what other grammars do not support

from leaflet-geoman.

xiyuvi avatar xiyuvi commented on June 15, 2024

Thank you, my compiler supports the "?." syntax, which I have also extensively used in projects. I am not sure what other syntax does not support

from leaflet-geoman.

Falke-Design avatar Falke-Design commented on June 15, 2024

Module parse failed: Unexpected token (1:4153)

When you look at the position of 1:4153 you will see that it points to ?.. Maybe your compiler supports ?. but not your loader

from leaflet-geoman.

xiyuvi avatar xiyuvi commented on June 15, 2024

Vue/cli5 can use the latest version, but Vue/cli4 will report an error. My skills are very poor and I don't know where I upgraded separately. "@ vue/cli plugin label": "~5.0.0", and

"@ vue/cli plugin slip": "~5.0.0", but the error still appears.

What I can confirm is that using Vue/cli5 directly can support the latest version. If others encounter compatibility issues, they can consider upgrading the Vue/cli scaffold directly

from leaflet-geoman.

giky avatar giky commented on June 15, 2024

I have the same problem

from leaflet-geoman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.