Open Cyenoch opened 12 months ago
+1,遇到同样的问题,报错如下: node version: v12.22.12
yarn run v1.22.17
$ vue-cli-service build --mode dev
⠙ Building for dev...
ERROR Failed to compile with 2 errors 7:13:21 PM
error in ./node_modules/ml-matrix/src/symmetricMatrix.js
Module parse failed: Unexpected character '#' (11:16)
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
|
| get size() {
> return this.#matrix.size;
| }
|
@ ./node_modules/ml-matrix/src/index.js 2:0-34 2:0-34
@ ./node_modules/@antv/layout/es/layout/mds.js
@ ./node_modules/@antv/layout/es/layout/layout.js
@ ./node_modules/@antv/layout/es/layout/index.js
@ ./node_modules/@antv/layout/es/index.js
@ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/use-detail/index.vue?vue&type=script&lang=js
@ ./src/components/use-detail/index.vue?vue&type=script&lang=js
@ ./src/components/use-detail/index.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/credential/index.vue?vue&type=script&lang=js
@ ./src/views/credential/index.vue?vue&type=script&lang=js
@ ./src/views/credential/index.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi ./src/main.js
error in ./node_modules/ml-matrix/src/matrix.js
Module parse failed: Unexpected token (1587:6)
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
| * @type {Float64Array[]}
| */
> data;
|
| /**
@ ./node_modules/ml-matrix/src/index.js 1:0-70 1:0-70 1:0-70 1:0-70
@ ./node_modules/@antv/layout/es/layout/mds.js
@ ./node_modules/@antv/layout/es/layout/layout.js
@ ./node_modules/@antv/layout/es/layout/index.js
@ ./node_modules/@antv/layout/es/index.js
@ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/use-detail/index.vue?vue&type=script&lang=js
@ ./src/components/use-detail/index.vue?vue&type=script&lang=js
@ ./src/components/use-detail/index.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/credential/index.vue?vue&type=script&lang=js
@ ./src/views/credential/index.vue?vue&type=script&lang=js
@ ./src/views/credential/index.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi ./src/main.js
ERROR Build failed with errors.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
+1,遇到同样的问题,报错如下: node version: v12.22.12
yarn run v1.22.17 $ vue-cli-service build --mode dev ⠙ Building for dev... ERROR Failed to compile with 2 errors 7:13:21 PM error in ./node_modules/ml-matrix/src/symmetricMatrix.js Module parse failed: Unexpected character '#' (11:16) 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 | | get size() { > return this.#matrix.size; | } | @ ./node_modules/ml-matrix/src/index.js 2:0-34 2:0-34 @ ./node_modules/@antv/layout/es/layout/mds.js @ ./node_modules/@antv/layout/es/layout/layout.js @ ./node_modules/@antv/layout/es/layout/index.js @ ./node_modules/@antv/layout/es/index.js @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/use-detail/index.vue?vue&type=script&lang=js @ ./src/components/use-detail/index.vue?vue&type=script&lang=js @ ./src/components/use-detail/index.vue @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/credential/index.vue?vue&type=script&lang=js @ ./src/views/credential/index.vue?vue&type=script&lang=js @ ./src/views/credential/index.vue @ ./src/router/index.js @ ./src/main.js @ multi ./src/main.js error in ./node_modules/ml-matrix/src/matrix.js Module parse failed: Unexpected token (1587:6) 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 | * @type {Float64Array[]} | */ > data; | | /** @ ./node_modules/ml-matrix/src/index.js 1:0-70 1:0-70 1:0-70 1:0-70 @ ./node_modules/@antv/layout/es/layout/mds.js @ ./node_modules/@antv/layout/es/layout/layout.js @ ./node_modules/@antv/layout/es/layout/index.js @ ./node_modules/@antv/layout/es/index.js @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/use-detail/index.vue?vue&type=script&lang=js @ ./src/components/use-detail/index.vue?vue&type=script&lang=js @ ./src/components/use-detail/index.vue @ ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/credential/index.vue?vue&type=script&lang=js @ ./src/views/credential/index.vue?vue&type=script&lang=js @ ./src/views/credential/index.vue @ ./src/router/index.js @ ./src/main.js @ multi ./src/main.js ERROR Build failed with errors. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我是直接override @antv/layout下的 ml-matrix版本到6.10.x
+1
+1. antv 最新版固定了版本,所以大家可以升级到最新版即可。 但是我用最新版会报其他错误,只能用旧版,旧版的话,这个问题不知道该如何解决。
补充:通过 overrides/resolutions 强制依赖的版本号即可解决
+1. antv 最新版固定了版本,所以大家可以升级到最新版即可。 但是我用最新版会报其他错误,只能用旧版,旧版的话,这个问题不知道该如何解决。
补充:通过 overrides/resolutions 强制依赖的版本号即可解决
补充: overrides字段需要npm版本在8以上才生效
老项目引用 @antv/layout 0.3.x 时可能导致构建失败的问题
@antv/layout引用的"ml-matrix": "^6.5.0" 由于^匹配版本 会导致(在没有package-lock的情况下) 下载到 6.11.0版本 6.11.0是ml-matrix两小时前发布的一个新版本,这个版本有用到private property,可能导致某些老项目打包失败
指路:
查看临时解决方式