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
Chore: Migrate build to vite #1033
base: master
Are you sure you want to change the base?
Conversation
…rweb into @juice10/@rrweb/types
going to look into this! BTW, have you ever considered tsup? |
To be honest I hadn't before reading your comment. Vite has so much momentum behind it and such broad support (libraries, svelte, vue, react, css, assets etc.), way less config heavy than the incumbents. And I felt really happy with it after ripping out webpack and raw rollup from a number of projects and replacing them with Vite. That made me think it was a good fit for us. But for some reason while using tsup on rrweb I end up bumping into errors while bundling. Bundling the normal files is fine but generating the typescript dts files it seems to have issues with. One thing I really like about Vite is that it comes with vitest, a super fast, drop in replacement for jest. Because it uses Vite under the hood, that's one less configuration step that needs to happen, which will make it easier for us to create packages (for example one per plugin) without all the configuration overhead. |
Turns out what we where doing by overwriting `public textContent: string | undefined` as a getter in a subclass is something that isn't allowed in typescript. Because we where using `// @ts-ignore` to hide this error our bundler chose to allow the overwrite. Vite choses to disallow the overwrite making all subclasses' `textContent` undefined. To mitigate this we're using an abstract class, which does allow sub classes to decide if they wan't to use getters or not.
This removes console from rrweb-all.js
@Juice10 Thanks for the detailed explanation! I mentioned tsup because in some other projects we found vite is good enough for packaging an app, but it still needs more config works to package a library. So we use vite to dev and build apps and tsup to build libraries. If rrweb is happy with vite, then a tsup may not be needed. Great work! |
We need to make sure this PR also addresses the following issues: https://publint.dev/rrweb@2.0.0-alpha.4 |
…o @juice10/vite
…o @juice10/vite
/tsconfig.base.json
.md
files to reflect new file names and plugin locationsyarn dev
to build with --watchapply virtual style rules to node
tests to rrweb from rrdom@rrweb/all
convenience package that bundles: record/replay/pack/unpack/plugins-console-record/plugins-console-replayTests passing:
failing: needs to be updated to jest 29 like rrdom
failing: needs to be updated to jest 29 like rrdom
failing
rrweb-player/no tests2 failed tests "rrweb is not defined"
@rrweb/typesno testsweb-extension/no testsplugins/rrweb-plugin-canvas-webrtc-record/no testsplugins/rrweb-plugin-canvas-webrtc-replay/no testsfailing locally some times; vite adds a console.debug message when included
plugins/rrweb-plugin-console-replay/no testsplugins/rrweb-plugin-sequential-id-record/no testsplugins/rrweb-plugin-sequential-id-replay/no testsBuild passing:
failing: rrweb does not export packer, packers should be moved to own package
publint passing (
yarn build && yarn test; npx publint; attw --pack .
):still needs umd version to make it work
not using vite yet, all type imports are broken
web-extension/(not an exposed package)