feat(build): use common build process #10
Merged
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.
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
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 usingVIS_DEBUG=yes npm run build
.