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

Bug when first argument is a string instead of an array of strings #9

Closed
jonaskuske opened this issue Aug 9, 2022 · 4 comments
Closed

Comments

@jonaskuske
Copy link

Works:

fullReloadPlugin(['dir/*.php'])

Breaks:

fullReloadPlugin('dir/*.php')

The argument is passed to Array.from, so dir/*.php is turned into ['d', 'i', 'r', '/', '*', ...]! Now all of these are watched as separate globs, including *, so lots of watcher processes are spawned, every single file in the project is watched and the development server slows to a crawl.

@jonaskuske jonaskuske changed the title Bug when a string is passed as files instead of an array of strings Bug when first argument is a string instead of an array of strings Aug 9, 2022
@ElMassimo
Copy link
Owner

It's not a bug, the plugin is expecting an Array.

If you have TypeScript in your editor it should warn you about it.

I'm ok accepting a pull request to throw an explicit error if it's not an Array.

@ElMassimo
Copy link
Owner

ElMassimo commented Aug 9, 2022

Confused it with another of my plugins.

Seems like Array.from is incorrectly used in the internals, I'll make a fix shortly.

@jonaskuske
Copy link
Author

Thanks! :)

@ElMassimo
Copy link
Owner

Thanks for reporting, released a fix in 1.0.4 😃

johannschopplich pushed a commit to johannschopplich/kirbyup that referenced this issue Aug 15, 2022
* feat: add support for `kirby serve` w/ HMR plugin

* feat: allow HMR refresh, abort only on HMR reload

* feat: rename module entry to _index.mjs

makes it clearer that module entries are an internal, dev-only feature

* docs: update examples to include serve script

* feat: reload on PHP change in serve mode

* feat: live-reload via CLI arg, CLI help, refactor

* fix: only call server.close() if still listening

* fix: set server.origin to serve assets in dev mode

depends on vuejs/vue#12732

* fix: always pass array to vite-full-reload-plugin

ElMassimo/vite-plugin-full-reload#9

* feat: specify port via cli instead of kirbyup conf

* refactor: update reload-plugin, remove workaround

* feat: make sure index.dev.mjs is gone after build

* feat: set index.dev.mjs location with --out-dir

* docs: update README for serve command

* docs: capitalize "panel"

* refactor: inline getViteConfig() type

* fix: only handle SIGINT, implemented like vite
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

No branches or pull requests

2 participants