Skip to content

Changing webpackMode to fetch - see symfony/stimulus-bridge#15 #53

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

Merged
merged 1 commit into from
Feb 1, 2021

Conversation

weaverryan
Copy link
Member

@weaverryan weaverryan commented Jan 27, 2021

Q A
Bug fix? yes(ish)
New feature? no
Tickets none
License MIT

Hi!

If symfony/stimulus-bridge#15 is merged, this updates the keys for all the UX packages.

The old webpackMode is kept for now. This will prevent errors if you're using an "old" Flex version (a version before this PR symfony/flex#735). We can remove that... eventually...

Cheers!

Keeping webpackMode for support of people using an old Flex version
tgalopin added a commit to symfony/stimulus-bridge that referenced this pull request Feb 1, 2021
…sent (weaverryan)

This PR was squashed before being merged into the main branch.

Discussion
----------

"fetch: lazy": don't download until the controller is present

Hi!

This deprecates the `webpackMode` option in `controllers.json` and replaces it with a new `lazy` option that can be set to `eager` or `lazy`.

The `lazy` mode is quite a bit smarter than the old `webpackMode: 'lazy'`. When you use this, the controller (and its dependencies) isn't downloaded until the corresponding `data-controller` appears on the page. This is great for things like chartjs, which is quite huge, but probably you don't have it on every page and a tiny delay is no problem.

PR to update the UX packages: symfony/ux#53

Cheers!

Fixes #3

Commits
-------

a9028b2 "fetch: lazy": don't download until the controller is present
@tgalopin
Copy link
Contributor

tgalopin commented Feb 1, 2021

Thanks Ryan.

@tgalopin tgalopin merged commit 3992d77 into symfony:main Feb 1, 2021
@weaverryan weaverryan deleted the using-fetch-option branch February 1, 2021 15:58
tgalopin added a commit to symfony/flex that referenced this pull request Feb 2, 2021
… "fetch" mode (weaverryan)

This PR was merged into the 1.9-dev branch.

Discussion
----------

Changing to support next version of stimulus bridge with "fetch" mode

Partner to symfony/stimulus-bridge#15 and symfony/ux#53

The tricky part about this is that, if the user has `stimulus-bridge` 1.x, then their `controllers.json` file needs `webpackMode`. If they have `stimulus-bridge` "next" (we're thinking it'll be 2.0), then their `controllers.json` file needs `fetch`. This means that Flex has a "hard break" and sorta just needs to assume that the user has the "new" version.

We made the decision - to go from `webpackMode` to `fetch` because the setting no longer is truly the same as `webpackMode`. However, if we wanted to make the upgrade path easier, we could revert that and use `webpackMode` in 2.0 as well (instead of changing to `fetch`).

Commits
-------

0c452b5 Changing to support next version of stimulus bridge with "fetch" mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants