vue-mini / create-vue-mini

🛠️ 创建 Vue Mini 小程序项目的最佳方案。
MIT License
29 stars 8 forks source link

支持构建组件库 #10

Closed lanseria closed 1 month ago

lanseria commented 1 month ago

似乎把库再次编译了一遍

app.js错误:
 TypeError: Cannot read property 'resolve' of undefined
    at Object.func (vue-mini.cjs.js:1349)
    at __REQUIRE__ (index.js?t=wechat&s=1721132134136&v=fee311f185b40021f6f604a3d78548b5:5)
    at vue-mini.cjs.js:2466
    at vue-mini.cjs.js:2466
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1
    at p.runWith (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at q (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at r (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at app.js?t=wechat&s=1721132134136&v=b8dd888485dcbddfa1eb694884f570c3:6
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1(env: macOS,mp,1.06.2402040; lib: 3.5.0)
TypeError: Cannot read property 'resolve' of undefined
    at Object.func (vue-mini.cjs.js:1349)
    at __REQUIRE__ (index.js?t=wechat&s=1721132134136&v=fee311f185b40021f6f604a3d78548b5:5)
    at vue-mini.cjs.js:2466
    at vue-mini.cjs.js:2466
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1
    at p.runWith (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at q (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at r (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at app.js?t=wechat&s=1721132134136&v=b8dd888485dcbddfa1eb694884f570c3:6
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1(env: macOS,mp,1.06.2402040; lib: 3.5.0)

看了作者的库,也没有实际使用的第三方库的UI的项目Demo,让我很难说在项目使用,如果要用第三方UI的情况下。但组件全部自己写应该是很好的选择

yangmingshan commented 1 month ago

你是用的这个吗?https://github.com/youzan/vant-weapp

lanseria commented 1 month ago

你是用的这个吗?https://github.com/youzan/vant-weapp

对的,依次遇到的问题是

  1. npm 构建报错,因为 模版配置了"miniprogramRoot": "dist/",所以我配置了

    
    "packNpmManually": true,
    "packNpmRelationList": [
      {
        "packageJsonPath": "./package.json",
        "miniprogramNpmDistDir": "/"??这里
      }
    ],

    跟typescript也没多大关系,使用了pnpm 作者你可以试试看

yangmingshan commented 1 month ago

你是如何使用的,可以给个仓库吗?

lanseria commented 1 month ago

你是如何使用的,可以给个仓库吗?

https://github.com/lanseria/zhoushan-cargo-mp 复现不了了,但还是不成功

yangmingshan commented 1 month ago

确实会有问题。create-vue-mini 应该支持小程序组件库的构建,目前仅支持纯 js 库的构建。

Kassell commented 1 month ago

你是如何使用的,可以给个仓库吗?

https://github.com/lanseria/zhoushan-cargo-mp 复现不了了,但还是不成功

提交了一个新的 PR,可以看一下,另外建议升级一下你的create-vue-mini的版本

lanseria commented 1 month ago

你是如何使用的,可以给个仓库吗?

https://github.com/lanseria/zhoushan-cargo-mp 复现不了了,但还是不成功

提交了一个新的 PR,可以看一下,另外建议升级一下你的create-vue-mini的版本

感谢,升级版本与这个pr冲突吗?

Kassell commented 1 month ago

你是如何使用的,可以给个仓库吗?

https://github.com/lanseria/zhoushan-cargo-mp 复现不了了,但还是不成功

提交了一个新的 PR,可以看一下,另外建议升级一下你的create-vue-mini的版本

感谢,升级版本与这个pr冲突吗?

有,我这个是基于新版本提交的pr,新版本的build.js中 dev和prod函数,ready状态增加了一些运行状态显示

yangmingshan commented 1 month ago

PR 合并时我会关闭这个 issue

calandnong commented 1 month ago

也可以看看这样的实现方式,支持组件库以及json内的alias: https://github.com/calandnong/vuemini-demo

calandnong commented 1 month ago

似乎把库再次编译了一遍

app.js错误:
 TypeError: Cannot read property 'resolve' of undefined
    at Object.func (vue-mini.cjs.js:1349)
    at __REQUIRE__ (index.js?t=wechat&s=1721132134136&v=fee311f185b40021f6f604a3d78548b5:5)
    at vue-mini.cjs.js:2466
    at vue-mini.cjs.js:2466
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1
    at p.runWith (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at q (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at r (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at app.js?t=wechat&s=1721132134136&v=b8dd888485dcbddfa1eb694884f570c3:6
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1(env: macOS,mp,1.06.2402040; lib: 3.5.0)
TypeError: Cannot read property 'resolve' of undefined
    at Object.func (vue-mini.cjs.js:1349)
    at __REQUIRE__ (index.js?t=wechat&s=1721132134136&v=fee311f185b40021f6f604a3d78548b5:5)
    at vue-mini.cjs.js:2466
    at vue-mini.cjs.js:2466
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1
    at p.runWith (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at q (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at r (WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1)
    at app.js?t=wechat&s=1721132134136&v=b8dd888485dcbddfa1eb694884f570c3:6
    at WASubContext.js?t=wechat&s=1721132134136&v=3.5.0:1(env: macOS,mp,1.06.2402040; lib: 3.5.0)

看了作者的库,也没有实际使用的第三方库的UI的项目Demo,让我很难说在项目使用,如果要用第三方UI的情况下。但组件全部自己写应该是很好的选择

可以看看: https://github.com/calandnong/vuemini-demo/blob/main/src/pages/home/index.json

yangmingshan commented 1 month ago

create-vue-mini v1.1.0 对小程序组件库提供了开箱支持。

yangmingshan commented 1 month ago

如何使用小程序组件库?