-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用v4.0.4脚手架安装 react vite 版本 编译微信小程序报错 #16226
Comments
装一下依赖就好啦 |
两种方法都试了,还是报错 |
4.0.7还是报错 |
4.0.7了,这个问题你们解决了没有,我也遇到了 |
我退回到4.0.0-beta.82就不报错了,只能先用着,看看后面有没有啥解决方法 |
没去关注了,之前公司搞个小程序想用这个框架的,后来报错就换了别的 |
你们换了uniapp还是什么 |
这个问题解决了吗? 4.0.7 依然遇到。 苹果m1
|
从vite编译 切换到 webpack5 ,一切正常! |
macOS 15, M3 Pro 芯片,遇到同样的问题。 React+SCSS+TypeScript+NutUI app.js错误:
TypeError: taro.getDefaultExportFromCjs is not a function
at VM2045 vendors.js:351
at VM2015 WASubContext.js:1
at _.runWith (VM2015 WASubContext.js:1)
at q (VM2015 WASubContext.js:1)
at n (VM2015 WASubContext.js:1)
at VM2044 taro.js:3
at VM2015 WASubContext.js:1
at _.runWith (VM2015 WASubContext.js:1)
at q (VM2015 WASubContext.js:1)
at n (VM2015 WASubContext.js:1)(env: macOS,mp,1.06.2405020; lib: 3.7.0) ➜ linglong_app git:(main) ✗ yarn dev:weapp
> [email protected] build:weapp
> taro build --type weapp --watch
👽 Taro v4.0.8
Tips:
1. 预览模式生成的文件较大,设置 NODE_ENV 为 production 可以开启压缩。
Example:
$ NODE_ENV=production taro build --type weapp --watch
vite v4.5.5 building for production...
watching for file changes...
build started...
transforming (92) node_modules/@tarojs/runtime/dist/utils/cache.jsDeprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
More info: https://sass-lang.com/d/legacy-js-api
Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
More info: https://sass-lang.com/d/legacy-js-api
✓ 539 modules transformed.
dist/pages/index/index.wxml 0.08 kB
dist/pages/index/index.json 0.09 kB │ gzip: 0.11 kB
dist/comp.json 0.11 kB │ gzip: 0.11 kB
dist/comp.wxml 0.14 kB
dist/app.json 0.22 kB │ gzip: 0.15 kB
dist/pages/index/index.wxss 0.40 kB
dist/utils.wxs 1.00 kB
dist/vendors.wxss 43.92 kB
dist/base.wxml 56.21 kB
dist/comp.js 0.16 kB │ gzip: 0.14 kB │ map: 0.41 kB
dist/app.js 0.77 kB │ gzip: 0.46 kB │ map: 0.70 kB
dist/pages/index/index.js 1.95 kB │ gzip: 0.82 kB │ map: 2.79 kB
dist/vendors.js 155.07 kB │ gzip: 39.81 kB │ map: 324.64 kB
dist/taro.js 445.95 kB │ gzip: 101.59 kB │ map: 744.31 kB
built in 5851ms. |
taro 4.0.8 m1 使用 vite 依然报错,根据楼上 大哥的建议 切换使用 webpack 后 问题解决 |
+1 |
4.0.8 m1还是报错,没人维护了吗? |
|
这个方法是有效的,其主要变更是添加了 {
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8",
"defaults and fully supports es6-module"
],
} |
@czfadmin 大佬, 你这个问题解决了吗? 我目前运行起来也是这样的现象 |
解决了 亲 换成 webpack 就好了~~~~不能用vite
… 2025年1月16日 11:31,h2t ***@***.***> 写道:
@czfadmin <https://github.com/czfadmin> 大佬, 你这个问题解决了吗? 我目前运行起来也是这样的现象
—
Reply to this email directly, view it on GitHub <#16226 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACRVUBUQDAYFFGCTPLWQQAT2K4RXRAVCNFSM6AAAAABL3YHCXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJUGQYDIOJUG4>.
You are receiving this because you commented.
|
用webpack吧 速度够用了不用过于追求vite |
v4.0.9 使用 vite 依然有这个问题 |
|
|
相关平台
微信小程序
小程序基础库: 3.5.1
使用框架: React
复现步骤
正常使用taro 命令创建项目,然后 dev:weapp
首先缺少
✓ 1 modules transformed.
[babel] [BABEL] D:\project\react-test\D:\project\react-test\src\app.ts?entry-loader=true: Cannot find module '@babel/preset-react'
然后缺少
✓ 1 modules transformed.
[babel] [BABEL] D:\project\react-test\D:\project\react-test\src\app.ts?entry-loader=true: Cannot find module '@babel/plugin-proposal-class-properties'
然后安装依赖完毕后 run dev:weapp
微信开发工具控制台报
app.js错误:
TypeError: taro.getDefaultExportFromCjs is not a function
期望结果
正常运行
实际结果
报错
环境信息
The text was updated successfully, but these errors were encountered: