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

Bundle with rollup #2098

Merged
merged 2 commits into from May 3, 2018

Conversation

Projects
None yet
2 participants
@TrySound
Copy link
Contributor

commented Apr 30, 2018

Ref #2084

In this diff I replace webpack with rollup for bundling source code.

I decided to use multiconfig instead of config with many options to
improve build time by eliminating node startup two more times. Also this
will simplify configuration in the future updates.

Changes

"umd" bundle for browser environment loads lodash.debounce from global._.debounce.

snapshot string is added by rollup to eliminate runtime condition.

watch:fast script does not generate source maps because they are not
fast enough.

Here's size comparision. I have some ideas how to reduce even
more.

cytoscape.js 893.0K
cytoscape.min.js 330.0K
cytoscape.umd.js 873.9K

cytoscape.js 834.9K
cytoscape.min.js 319.0K
cytoscape.umd.js 812.2K

Bundle with rollup
In this diff I replace webpack with rollup for bundling source code.

I decided to use multiconfig instead of config with many options to
improve build time by eliminating node startup two more times. Also this
will simplify configuration in the future updates.

Changes

"umd" bundle for browser environment loads `lodash.debounce` from `global._.debounce`.

`snapshot` string is added by rollup to eliminate runtime condition.

`watch:fast` script does not generate source maps because they are not
fast enough.

Here's size comparision. I have some ideas how to reduce even
more.

cytoscape.js 893.0K
cytoscape.min.js 330.0K
cytoscape.umd.js 873.9K

cytoscape.js 834.9K
cytoscape.min.js 319.0K
cytoscape.umd.js 812.2K

@maxkfranz maxkfranz self-requested a review Apr 30, 2018

@maxkfranz

This comment has been minimized.

Copy link
Member

commented May 2, 2018

This looks great!

I made a small patch:
rollup-esm-etc.patch.txt

git apply rollup-esm-etc.patch

Tweaks

  • Enabled sourcemaps for watch:fast -- needed for /debug page
  • Reduce repetition in rollup conf.
  • Misc. linting fixes
  • Added esm target and 'module' key in package.json. Might have made some mistakes here...
  • Builds for dist now include sourcemaps -- except for .min.js file
  • Add build:* targets back -- not used for main build target -- just for easy 1-file building
@maxkfranz

This comment has been minimized.

Copy link
Member

commented May 2, 2018

Let me know what you think and if we need any other changes. I'm not sure if the esm build is working perfectly, for example, I just inspected the output in vim.

@TrySound

This comment has been minimized.

Copy link
Contributor Author

commented May 2, 2018

@maxkfranz esm build I planned to add later with a couple of suggestions. This is just 1:1 migration from webpack. Repetition is a step to simplicity which I also gonna propose in the next PR.

Let's do thing step by step and discuss them separately.

@maxkfranz maxkfranz merged commit 5cdbf6a into cytoscape:unstable May 3, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@TrySound TrySound deleted the TrySound:rollup-bundles branch May 6, 2018

@maxkfranz maxkfranz added this to the 3.3.0 milestone Nov 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.