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

feat(build): use common build process #10

Merged
merged 1 commit into from
Feb 17, 2020
Merged

Conversation

Thomaash
Copy link
Member

@Thomaash Thomaash commented Feb 9, 2020

This is basically what has been done already in Timeline (visjs/vis-timeline#269). It's just packaged in a reusable way with a bunch of assertions to ensure the same format of exports in all of the projects.

Exports

  • Standalone: Everything's bundled including CSS and images linked from CSS.
  • Peer: Dependencies that cause compatibility issues are not bundled (Vis Data and Moment). CSS is also separate. The rest is bundled.
  • ESNext: Nothing is bundled, not even polyfills.

Breaking changes

This will change the way default imports from npm packages behave but nothing will change for the people using them from unpkg.com. Fixing this should be as simple as installing Vis Data and potentially Moment separately.

Bundle size

Using the ESNext builds seems to decrease bundle size by about 20 % in standalone builds, about 7 % in peer and 0 % in ESNext. ESNext will however use polyfills supplied by the user or none at all leading to deduplication of polyfills in user's apps and potential reduction by ditching support for unneeded browsers.

Usage

This exports a function that generates Rollup configuration object. The object can be modified in any way (splice more plugins, change any property and so on) in case it's necessary. TypeScript is automatically processed if the entry point is .ts or omitted if it is .js. It is also possible to ignore validation failures, keep debug blocks (stripInProduction: { debug code }) and get some more details by using VIS_DEBUG=yes npm run build.

@Thomaash Thomaash requested a review from a team February 9, 2020 16:58
@yotamberk yotamberk merged commit da17378 into master Feb 17, 2020
@yotamberk yotamberk deleted the common-build-format branch February 17, 2020 19:52
@vis-bot
Copy link
Collaborator

vis-bot commented Feb 17, 2020

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Thomaash added a commit to visjs/vis-util that referenced this pull request Feb 29, 2020
BREAKING CHANGE: The old bundles are no longer present in the package. It has to be replaced by import * as util from 'vis-util/esnext';. I'll do that in all of our projects so don't bother updating to this, it most likely won't work anyway.

The build process from visjs/vis-dev-utils#10 is finally being deployed tada.

I also increased the timeout of some tests because they kept failing solely due to not having enough of time to finish.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants