Skip to content

TypeError: taro.getDefaultExportFromCjs is not a function #31

@tiamed

Description

@tiamed

@tarojs/plugin-platform-alipay-dd: 0.3.1
dingtalk-design-cli: 1.0.10

复现步骤

  • taro init创建项目
  • npm run dev:dd (taro build --type dd --watch)
  • cd dist && cp ~/projects/dd-demo/ding.config.json ./ && ding dev
  • web 回车

使用脚手架创建,编译工具选择vite,模板如下

  "templateInfo": {
    "name": "react-NutUI",
    "typescript": true,
    "css": "Sass",
    "framework": "React"
  }

Taro环境

  Taro CLI 4.0.6 environment info:
    System:
      OS: Linux 6.10 EndeavourOS
      Shell: 5.9 - /usr/bin/zsh
    Binaries:
      Node: 20.14.0 - /run/user/1000/fnm_multishells/1193122_1727266966430/bin/node
      npm: 10.7.0 - /run/user/1000/fnm_multishells/1193122_1727266966430/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/components: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/helper: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-framework-react: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-html: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-alipay: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-h5: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-jd: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-qq: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-swan: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-tt: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/plugin-platform-weapp: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/react: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/runtime: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/shared: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/taro: 4.0.0-beta.138 => 4.0.0-beta.138 
      @tarojs/vite-runner: 4.0.0-beta.138 => 4.0.0-beta.138 
      babel-preset-taro: 4.0.0-beta.138 => 4.0.0-beta.138 
      eslint-config-taro: 4.0.0-beta.138 => 4.0.0-beta.138 
      react: ^18.0.0 => 18.3.1 

报错信息

af-appx.worker.min.js:26 ap/SDKVersion: 1.25.9
af-appx.worker.min.js:26 TypeError: taro.getDefaultExportFromCjs is not a function
    at Object.oyTv (index.js:8:1)
    at __webpack_require__ (bootstrap:19:1)
    at Object.ZVdI (index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:1070:15)
    at __webpack_require__ (bootstrap:19:1)
    at Object.GfhN (index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:982:12)
    at __webpack_require__ (bootstrap:19:1)
    at callback (index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:829:9)
    at success (index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:950:9)
    at af-appx.worker.min.js:26:142083
    at n (af-appx.worker.min.js:26:142467)
Kv.onerror @ af-appx.worker.min.js:26
i @ af-appx.worker.min.js:26
(anonymous) @ af-appx.worker.min.js:26
n @ af-appx.worker.min.js:26
No.bootstrapApp @ af-appx.worker.min.js:26
C7Oz.module.exports @ index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:952
(anonymous) @ index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:848
4/3G @ index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:856
__webpack_require__ @ bootstrap:19
0 @ index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:105
__webpack_require__ @ bootstrap:19
(anonymous) @ bootstrap:83
installedModules @ index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:6
(anonymous) @ index.worker.js?hash=7aff534e&from_service_worker=true&url=http%3A%2F%2F127.0.0.1%3A9001%2Findex.html&ap_framework_sceneId=0000:6
runInContext @ node:vm:148
runInContext @ node:vm:300
evaluateScript @ worker.js:1
(anonymous) @ worker.js:1
i @ worker.js:1
processTicksAndRejections @ node:internal/process/task_queues:95
Promise.then (async)
c @ worker.js:1
(anonymous) @ worker.js:1
p @ worker.js:1
p @ worker.js:1
(anonymous) @ worker.js:1
(anonymous) @ worker.js:1
p @ worker.js:1
(anonymous) @ worker.js:1
(anonymous) @ worker.js:1
listOnTimeout @ node:internal/timers:573
processTimers @ node:internal/timers:514
Timeout (async)
init @ node:internal/inspector_async_hook:25
emitInitNative @ node:internal/async_hooks:202
emitInitScript @ node:internal/async_hooks:505
initAsyncResource @ node:internal/timers:160
Timeout @ node:internal/timers:194
setTimeout @ node:timers:166
(anonymous) @ worker.js:1
(anonymous) @ worker.js:1
p @ worker.js:1
(anonymous) @ worker.js:1
onMessage @ worker.js:1
[nodejs.internal.kHybridDispatch] @ node:internal/event_target:825
(anonymous) @ node:internal/per_context/messageport:23
callbackTrampoline @ node:internal/async_hooks:130

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions