Closed nervouself closed 2 years ago
现在对 floating ui 的 import 处理是临时的……后面会改成直接 import npm 包中的 @floatin-ui/dom
不过要稍等一段时间,由于一些目前还没解决的问题(估计还需要一两周)
感谢
已修复: https://github.com/ant-design/ant-design-mobile/commit/c0ef3fca2450529d3e1ee838bbe66414bb521897
升级 antd-mobile 到 5.8.0 就可以了
@awmleer 此问题并未修复(5.8.2)
@freecnpro 你使用的脚手架是 umi 么?可以发一下 package.json 么
@awmleer 对,用的umi
{
"name": "xxx",
"version": "2.0.0",
"private": true,
"scripts": {
"analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build",
"prettier": "prettier -c --write \"src/**/*\"",
"start": "umi dev",
"dev": "umi dev"
},
"lint-staged": {
"**/*.less": "stylelint --syntax less",
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
"**/*.{js,jsx,tsx,ts,less,md,json}": [
"prettier --write"
]
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
],
"dependencies": {
"@ant-design/charts": "^1.2.9",
"@ant-design/icons": "^4.6.3",
"@ant-design/pro-card": "^1.18.31",
"@ant-design/pro-form": "^1.47.0",
"@ant-design/pro-layout": "^6.24.0",
"@ant-design/pro-table": "^2.48.0",
"@antv/f2": "^3.8.10-beta.1",
"@antv/g2plot": "^2.3.31",
"@umijs/route-utils": "^1.0.37",
"ahooks": "^2.0.0",
"ali-oss": "^6.16.0",
"antd": "^4.18.6",
"antd-mobile": "^5.8.2",
"antd-mobile-icons": "^0.2.2",
"classnames": "^2.2.6",
"hash.js": "^1.1.7",
"immutability-helper": "^3.1.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"numeral": "^2.0.6",
"nzh": "^1.0.4",
"path-to-regexp": "^6.2.0",
"qrcode.react": "^1.0.1",
"qs": "^6.10.0",
"react": "^17.0.2",
"react-color": "^2.19.3",
"react-device-detect": "^2.0.1",
"react-dnd": "^11.1.3",
"react-dnd-html5-backend": "^11.1.3",
"react-dom": "^17.0.2",
"react-gantt-antd-hzm": "^1.0.26",
"react-image-magnify": "^2.7.4",
"react-infinite-scroller": "^1.2.4",
"react-resizable": "^1.11.1",
"react-signature-canvas": "^1.0.3",
"react-sortablejs": "^6.0.0",
"react-to-print": "^2.12.3",
"react-viewer": "^3.2.2",
"react-webcam": "^5.2.2",
"sortablejs": "^1.13.0",
"umi-request": "^1.3.9",
"video-react": "^0.14.1"
},
"devDependencies": {
"@types/classnames": "^2.2.11",
"@types/express": "^4.17.11",
"@types/history": "^4.7.8",
"@types/jest": "^26.0.21",
"@types/lodash": "^4.14.168",
"@types/qs": "^6.9.6",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"@umijs/fabric": "^2.5.7",
"@umijs/plugin-esbuild": "^1.1.0",
"@umijs/preset-react": "^1.8.22",
"chalk": "^4.1.0",
"cross-env": "^7.0.3",
"eslint": "^7.22.0",
"lint-staged": "^10.5.4",
"postcss": "^8.2.8",
"postcss-import": "^14.0.0",
"prettier": "^2.2.1",
"puppeteer-core": "^8.0.0",
"qiniu-upload-webpack-plugin": "^2.1.6",
"stylelint": "^13.12.0",
"typescript": "^4.2.3",
"umi": "^3.5.17"
},
"engines": {
"node": ">=10.0.0"
},
"checkFiles": [
"common/**/*.js*",
"common/**/*.less*",
"src/**/*.js*",
"src/**/*.ts*",
"src/**/*.less",
"config/**/*.js*",
"scripts/**/*.js"
]
}
@freecnpro 你是不是开启了 MFSU?
@awmleer build的时候没有开启,dev有开启,但build同样不行
@freecnpro 试一下 umi 的 chainWebpack
中加一下这个吧:
config.module.rule('mjs-rule').test(/.m?js/).resolve.set('fullySpecified', false);
@freecnpro 试一下 umi 的
chainWebpack
中加一下这个吧:config.module.rule('mjs-rule').test(/.m?js/).resolve.set('fullySpecified', false);
Fixed
roadhog 脚手架也出现这个问题,不知道咋破
Version of antd-mobile
5.7.2
Description
module../../common/temp/node_modules/.pnpm/@floating-ui+core@0.5.1/node_modules/@floating-ui/core/dist/floating-ui.core.cjs Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (1:0) File was processed with these loaders:
猜测应该是在 popover 组件中引入的
floating-ui/dom
min 文件 用 require 引入了floating-ui/core
中的 cjs 结尾的文件,cjs 结尾的文件命中了 file-loader 对于 cjs 的特殊规则手动把 node_modules 中
@floating-ui/core
的 package.json 中的 exports.require 由./dist/floating-ui.core.cjs
改成./dist/floating-ui.core.js
,问题解决请问下这个可以兼容吗