feat: add multiple build output formats (ES/CJS/UMD)#677
Open
UmbraCi wants to merge 2 commits intohizzgdev:masterfrom
Open
feat: add multiple build output formats (ES/CJS/UMD)#677UmbraCi wants to merge 2 commits intohizzgdev:masterfrom
UmbraCi wants to merge 2 commits intohizzgdev:masterfrom
Conversation
- Configure Rollup to generate three output formats: - ES Module (es/) for modern bundlers with tree-shaking - CommonJS (lib/) for require/legacy toolchains - UMD (dist/) for direct script usage with global variables - Update package.json exports to support all formats - Add build outputs to .gitignore - Support both unpkg and jsdelivr CDN usage
Contributor
Author
|
@hizzgdev 辛苦看下 |
hizzgdev
reviewed
Dec 14, 2025
| "version": "0.9.0", | ||
| "description": "jsMind is a pure javascript library for mindmap, it base on html5 canvas. jsMind was released under BSD license, you can embed it in any project, if only you observe the license.", | ||
| "main": "es6/jsmind.js", | ||
| "main": "lib/jsmind.js", |
Owner
There was a problem hiding this comment.
之前的 "main":"es6/jsmind.js" 其实是现在的 "dist/jsmind.js"
这里要与之前的版本保持兼容。
| // ES Module - for modern bundlers with tree-shaking support | ||
| { | ||
| file: 'es/jsmind.js', | ||
| format: 'es', |
Owner
There was a problem hiding this comment.
为什么需要导出为 es 格式呢?需要的话是不是可以直接使用源码?这样的 output 它会把其它依赖的文件打包在一起吗?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for multiple build output formats to better serve different use cases.
Changes
mainto CommonJS entrymoduleto ES Module entryunpkgfields for CDN usageexportsfield to support conditional importsfilesfieldBenefits
<script>tagsTesting