Skip to content

[Question] 0.1.32 umd打包如何生成 xxx.d.ts 文件 #131

Open

Description

@wuchendi

Hey, man.

我目前在投入 lowcode 相关工作,在 lowcode 当中,我注意到他们使用了 "@alib/build-scripts": "^0.1.32" 进行构建和打包。

然而,我目前无法找到关于这个配置的任何文档。如果您了解相关信息,是否能够分享给我呢?

我的问题是,在生成 UMD 文件时,应该如何生成 xxx.d.ts 文件?以下是我的配置文件:

  • package.json
{
  "scripts": {
    "build": "build-scripts build && build-scripts build --config=build.umd.json"
  }
}
  • build.umd.json
{
  "entry": {
    "vue-renderer": "./src/index.ts"
  },
  "sourceMap": true,
  "library": "LCVueRenderer",
  "libraryTarget": "umd",
  "externals": {
    "vue": "var window.Vue"
  },
  "outputAssetsPath": {
    "js": "",
    "css": ""
  },
  "polyfill": false,
  "outputDir": "dist",
  "vendor": false,
  "ignoreHtmlTemplate": true,
  "plugins": [
    "build-plugin-react-app",
    ["build-plugin-moment-locales", { "locales": ["zh-cn"] }],
    "./build.plugin.cjs"
  ]
}

Activity

  1. ClarkXia commented on Jul 19, 2023

    @ClarkXia
    Collaborator

    *.d.ts 由 ts 编译生成,一般在编译 es / lib 目录时会生成,在消费 umd 的时候是不需要的

  2. wuchendi commented on Jul 19, 2023

    @wuchendi
    Author

    *.d.ts 由 ts 编译生成,一般在编译 es / lib 目录时会生成,在消费 umd 的时候是不需要的

    Thank you for your response.

    是的呢,目前构建之后看结果是这样,但是我这边不太想提供 es/ lib 目录,想提供 dist 产物就好,支持这样的配置吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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