Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Publish ESM on CDN #999

Open
1 task done
otakustay opened this issue Sep 15, 2022 · 7 comments · May be fixed by #1033
Open
1 task done

[Feature Request]: Publish ESM on CDN #999

otakustay opened this issue Sep 15, 2022 · 7 comments · May be fixed by #1033
Labels
feature request Things want to be added

Comments

@otakustay
Copy link

Preflight Checklist

  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

What package is this feature request for?

rrweb

Problem Description

For pages that asynchronously install rrweb recorder, we currently use createElement('script') and script.onload to lazy import rrweb-record.min.js, but it will be more confortable if we can simply use await import('rrweb-record.esm.js').

Proposed Solution

Build and publish bundled ESM modules alongside current dist

Alternatives Considered

Using createElement('script') works but is a little complicated

Additional Information

No response

@otakustay otakustay added the feature request Things want to be added label Sep 15, 2022
@YunFeng0817
Copy link
Member

@otakustay
Copy link
Author

Since these es files seems to be generated directly from ts files, I'm not sure if they will include some new language features that not work on older (but still supports ESM) browsers, maybe a bundled version can be better

@YunFeng0817
Copy link
Member

They are actually bundled with rollup. You can see the bundling configuration here: https://github.com/rrweb-io/rrweb/blob/master/packages/rrweb/rollup.config.js

@otakustay
Copy link
Author

I still see some import statements in src/record/index.js, would it be possible that the ES version is exactly like the single file dist version, elliminating multiple network requests?

@YunFeng0817
Copy link
Member

I think it's possible but we don't have enough time to create a separate config for this situation.

@otakustay
Copy link
Author

I'm going to try to create a PR for this

@Juice10
Copy link
Contributor

Juice10 commented Nov 2, 2022

I believe this PR might fix it: #1033
It's not finished yet but includes esm in release

@YunFeng0817 YunFeng0817 linked a pull request Feb 6, 2023 that will close this issue
62 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Things want to be added
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants