Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(umd): prevent inclusion of Vue in bundle #635

Merged
merged 6 commits into from
Mar 7, 2019
Merged

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Mar 6, 2019

This is fixed in two spots:

  1. add Vue to externals for the UMD (used in Panel)
  2. use the Vue object passed to the install function instead of importing it ourselves (in the plugin)

Furthermore this also fixes the plugin which needlessly exposes all widgets (you can already import them easily, since the default export is being put on the window)

@Haroenv Haroenv added the bug label Mar 6, 2019
@Haroenv Haroenv requested a review from a team March 6, 2019 13:49
@francoischalifour
Copy link
Member

This warning appears while building.

src/instantsearch.umd.js → dist/vue-instantsearch.js...
┌────────────────────────────────────────────┐
│                                            │
│   Destination: dist/vue-instantsearch.js   │
│   Bundle Size:  224.06 KB                  │
│   Minified and Gzipped Size:  57.93 KB     │
│                                            │
└────────────────────────────────────────────┘
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
vue (guessing 'Vue')

@Haroenv
Copy link
Contributor Author

Haroenv commented Mar 6, 2019

good call, I didn't have it earlier, but can replicate now @francoischalifour

@Haroenv
Copy link
Contributor Author

Haroenv commented Mar 6, 2019

by the way, nice effect of this:

before

src/instantsearch.umd.js → dist/vue-instantsearch.js...
┌────────────────────────────────────────────┐
│                                            │
│   Destination: dist/vue-instantsearch.js   │
│   Bundle Size:  284.17 KB                  │
│   Minified Size:  281.05 KB                │
│   Gzipped Size:  79.27 KB                  │
│                                            │
└────────────────────────────────────────────┘

after

src/instantsearch.umd.js → dist/vue-instantsearch.js...
┌────────────────────────────────────────────┐
│                                            │
│   Destination: dist/vue-instantsearch.js   │
│   Bundle Size:  224.09 KB                  │
│   Minified Size:  221.15 KB                │
│   Gzipped Size:  57.93 KB                  │
│                                            │
└────────────────────────────────────────────┘

@Haroenv Haroenv mentioned this pull request Mar 6, 2019
@francoischalifour
Copy link
Member

Nice decrease!

src/plugin.js Outdated Show resolved Hide resolved
@samouss
Copy link
Contributor

samouss commented Mar 6, 2019

It's better without Vue embed!

@Haroenv Haroenv merged commit a90cbce into master Mar 7, 2019
@Haroenv Haroenv deleted the fix/umd-woes branch March 7, 2019 13:46
Haroenv added a commit to algolia/instantsearch that referenced this pull request Dec 28, 2022
…ch#635)

* fix(umd): do not bundle Vue

* fix(umd): use Vue instance of provided component

* fix(umd): make import clearer

* fix(rollup): specify which global Vue uses

* refactor(plugin): clearer naming
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants