Coder Social home page Coder Social logo

Comments (5)

jizai1125 avatar jizai1125 commented on August 15, 2024

能给个复现么

from vue-countup-v3.

bilibala2 avatar bilibala2 commented on August 15, 2024

可能是因为我的主项目的 package.json 文件就是要求 "type": "module",所以会出现这个错误,但这个要求我没有办法更改。
主项目的 package.json 部分内容如下:
"type": "module","private": true,
"vue": "^3.2.47"

引入代码:
`<script setup lang="ts">
import CountUp from 'vue-countup-v3';

const { endVal = 384200 } = defineProps<{
endVal: number;
}>()
</script>

`

使用命令: npm build 执行代码构建。
修改 /node_modules 文件夹中的 vue-countup-v3 的 package.json 文件:
"types": "dist/countup.vue.d.ts", "type": "module",
只是加上了 "type": "module", 就可以构建成功。
但是加上了这个之后,npm run dev 就会报错,必须要去掉才可以运行成功。

from vue-countup-v3.

jizai1125 avatar jizai1125 commented on August 15, 2024

你是在 nuxt 中用的?配置下 build.transpile, 参考 issue

import { defineNuxtConfig } from 'nuxt3';

export default defineNuxtConfig({
  build: {
    transpile: ['vue-countup-v3'],
  },
});

from vue-countup-v3.

bilibala2 avatar bilibala2 commented on August 15, 2024

我的项目并不是 nuxt 框架的,而是使用 astro+vue3

from vue-countup-v3.

jizai1125 avatar jizai1125 commented on August 15, 2024

我的项目并不是 nuxt 框架的,而是使用 astro+vue3

加个指令 client:only

  <CountUp client:load client:only end-val={2000} />

相关 issue: withastro/astro#6321

from vue-countup-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.