Subscribe on changes!

isFunction is not a function at defineComponent

avatar
Feb 29th 2024

Vue version

3.4.21

Link to minimal reproduction

Steps to reproduce

use defineComponent in @element-plus/icons-vue@2.3.1

What is expected?

No errors

What is actually happening?

Error that breaks the application.

Uncaught TypeError: isFunction is not a function
    at defineComponent (runtime-core.esm-bundler.js:2440:10)
    at index.js:7:80

file:@vue+runtime-core@3.4.21/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js

/*! #__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function defineComponent(options, extraOptions) {
  return isFunction(options) ? (
    // #8326: extend call and options.name access are considered side-effects
    // by Rollup, so we have to wrap it in a pure-annotated IIFE.
    /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  ) : options;
}

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 2.17 GB / 15.83 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE      
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD        
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.11 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Internet Explorer: 11.0.19041.3636

Any additional comments?

No response

avatar
Feb 29th 2024

The reproduction you provided doesn't occur any errors, did you paste the wrong link?

avatar
Feb 29th 2024

sorry, it's not my use defineComponent, it's in @element-plus/icons-vue@2.3.1

/*! Element Plus Icons Vue v2.3.1 */


// unplugin-vue:/home/runner/work/element-plus-icons/element-plus-icons/packages/vue/src/components/add-location.vue?vue&type=script&setup=true&lang.ts
import { defineComponent as _defineComponent } from "vue";
import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
var add_location_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ _defineComponent({
  name: "AddLocation",
  __name: "add-location",
  setup(__props) {
    return (_ctx, _cache) => (_openBlock(), _createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      _createElementVNode("path", {
        fill: "currentColor",
        d: "M288 896h448q32 0 32 32t-32 32H288q-32 0-32-32t32-32"
      }),
      _createElementVNode("path", {
        fill: "currentColor",
        d: "M800 416a288 288 0 1 0-576 0c0 118.144 94.528 272.128 288 456.576C705.472 688.128 800 534.144 800 416M512 960C277.312 746.688 160 565.312 160 416a352 352 0 0 1 704 0c0 149.312-117.312 330.688-352 544"
      }),
      _createElementVNode("path", {
        fill: "currentColor",
        d: "M544 384h96a32 32 0 1 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96v-96a32 32 0 0 1 64 0z"
      })
    ]));
  }
});
avatar
Feb 29th 2024

This didn't help, can you provide a minimal reproduction?

avatar
Feb 29th 2024

This didn't help, can you provide a minimal reproduction?

https://stackblitz.com/edit/vitejs-vite-95kqzr?file=package.json,src%2Fmain.js,src%2FApp.vue&terminal=dev it's happen when i use "@element-plus/icons-vue": "^2.3.1", and "@form-create/element-ui": "^2.5.33", but @form-create/element-ui@2.x is used for Vue2, there's no error when i update @form-create/element-ui to the 3.x version.

avatar
Feb 29th 2024

So the problem was a dependency that is not for Vue 3? Then we don't have a bug. Closing this.

avatar
Feb 29th 2024

yes, thank u!