rslib icon indicating copy to clipboard operation
rslib copied to clipboard

Rslib features track

Open Timeless0911 opened this issue 1 year ago • 7 comments

CLI

  • [x] Support npm create rslib@latest to create a Rslib project
  • [x] Support --inspect to show Rslib/Rsbuild/Rspack config
  • [x] #138
  • [ ] Add some debug info to better debugging Rslib

Config

  • [x] Provide preset templates to default set some common configs for basic scenes
  • [ ] Support better shared Rsbuild config

Features

We try to keep the features aligned with Modern.js Module

bundle / bundleless

  • [x] basic support

format

output.library.type

  • [x] cjs
  • [x] esm
  • [x] umd
  • [x] mf

platform

  • [x] support output.target
  • [x] support control the syntax target for downgration

alias

autoExtension

  • [x] js extension
    • [x] .js with esm format and .cjs with cjs format when type: module
    • [x] .js with cjs format and .mjs with esm format when type: commonjs
  • [x] dts extension
    • [x] .d.ts with esm format and .d.cts with cjs format when type: module
    • [x] .d.ts with cjs format and .d.mts with esm format when type: commonjs

externals

output.externals

  • [x] prevent externalizing entry modules in bundleless mode
  • [x] make node built-in modules external when target is node
  • [x] support auto external dependencies and peerDependencies
  • [x] support tools.swc to external helpers

redirect

  • [x] redirect in js outputs of bundleless mode
    • [x] path
    • [x] extension (import/export)
    • [x] style
    • [x] asset path
  • [x] redirect in DTS outputs of bundleless mode
    • [x] path
    • [x] extension

shims

  • [x] shims __filename and __dirname in esm
  • [x] shims import.meta.url in cjs
  • [x] set module.parser.javascript.importMeta = false in esm

banner & footer

  • [x] integrate banner-plugin to inject content
  • [x] support inject in dts files

dts

  • [x] support cleanDistPath to clean DTS output before emit
  • [x] use ts compiler API to generate bundleless dts
    • [x] watch api in watch mode
    • [x] incremental build with project reference
  • [x] use api-extractor to generate dts bundle
    • [x] auto external packages
  • [x] optimize log output and error handler
  • [x] support autoExtension for dts files
  • [x] support abortOnError option to control whether to exit process when dts build error
  • [ ] support generate dts when isolatedDeclarations enabled

css

Module Federation

  • [x] https://github.com/web-infra-dev/rslib/issues/212

input

copy

define

minify

outDir

resolve

sourcemap

transformImport

decorators

asset

polyfill

  • [x] node polyfill
  • [x] polyfill with core-js-pure

prebundle

  • [ ] like what ncc do

Ecosystem

  • [x] Storybook integration
  • [ ] Support using Rspress to build a static site for module doc
  • [ ] Monorepo development with fast one-time HMR
  • [ ] Simple bump and publish workflow
  • [x] Vue component support

Advanced

  • [ ] JS API
  • [ ] Zero-config use
  • [ ] Config check

Migration

  • [x] Config map between Rslib and Modern.js Module
  • [x] Migrate E2E test cases from Modern.js Module
  • [ ] performance benchmark with other tools
  • [ ] Adding integration tests about using Rsbuild to bundle packages built by Rslib

Timeless0911 avatar Jul 26 '24 09:07 Timeless0911

Usually this kind of tools need extends options, don't you think?

yee94 avatar Aug 20 '24 03:08 yee94

Usually this kind of tools need extends options, don't you think?

Can you give some examples of what extends is going to do?

Timeless0911 avatar Aug 20 '24 03:08 Timeless0911

突然说 Modern.js Module 不推荐使用,用 rslib 了,测试了一下,更简单很灵活,很棒!

另外请完善文档(以及中文文档支持),例如 Tailwind CSS 等只库上使用,打包不使用,自定义模板等等,现在这个文档  😂

功能请求:npm create rslib@latest 请添加一些命令行参数,可以选择不交互模式,如 --name / -n 名称,-lang / -l = ts ,additional : -a =biome 等等,方便拷贝一条命令就可以创建项目,而不是交互模式。

lanmingle avatar Nov 15 '24 03:11 lanmingle

@lanmingle

突然说 Modern.js Module 不推荐使用,用 rslib 了,测试了一下,更简单很灵活,很棒!

Thank you for your dogfooding, we will release the first stable version 0.1.0 in the end of year.

另外请完善文档(以及中文文档支持),例如 Tailwind CSS 等只库上使用,打包不使用,自定义模板等等,现在这个文档 😂

Rslib documentation is still under construction, stay tuned for a stable version and we will translate the Chinese document after the English document is completed.

功能请求:npm create rslib@latest 请添加一些命令行参数,可以选择不交互模式,如 --name / -n 名称,-lang / -l = ts ,additional : -a =biome 等等,方便拷贝一条命令就可以创建项目,而不是交互模式。

You can open an issue in https://github.com/rspack-contrib/create-rstack.

Timeless0911 avatar Nov 15 '24 03:11 Timeless0911

You can open an issue in https://github.com/rspack-contrib/create-rstack.

create-rslib already provides some CLI flags, see: https://lib.rsbuild.dev/guide/start/quick-start#quick-creation

chenjiahan avatar Nov 15 '24 03:11 chenjiahan

@lanmingle

突然说 Modern.js Module 不推荐使用,用 rslib 了,测试了一下,更简单很灵活,很棒!

Thank you for your dogfooding, we will release the first stable version 0.1.0 in the end of year.

另外请完善文档(以及中文文档支持),例如 Tailwind CSS 等只库上使用,打包不使用,自定义模板等等,现在这个文档 😂

Rslib documentation is still under construction, stay tuned for a stable version and we will translate the Chinese document after the English document is completed.

功能请求:npm create rslib@latest 请添加一些命令行参数,可以选择不交互模式,如 --name / -n 名称,-lang / -l = ts ,additional : -a =biome 等等,方便拷贝一条命令就可以创建项目,而不是交互模式。

You can open an issue in https://github.com/rspack-contrib/create-rstack.

https://github.com/rspack-contrib/create-rstack/issues/21

lanmingle avatar Nov 15 '24 06:11 lanmingle

Please also consider support for svelte components

NaviTheCoderboi avatar Nov 22 '25 12:11 NaviTheCoderboi