Skip to content

Conversation

Kolobok12309
Copy link
Contributor

@Kolobok12309 Kolobok12309 commented Feb 11, 2025

Description

Currently vue-plugin ignore watcher and use default vite config for it (root without node_modules), it not worked for monorepo's. And hmr not worked for shared script/style with src like this, but worked for .vue (reason later)

// node_modules/shared/index.vue
<template>
  <div> foo</div>
</template>

<script src="./index.ts"></script>

// node_modules/shared/index.ts
export default defineComponent({
  ...
})

In contrast of this internal vite-esbuild plugin add imports to watcher (because of it .vue hmr worked, because it imports from ts/js)

fix #397

Additional context

By default vite doesn't support hmr for node_modules, we enable it by vitejs/vite#8619 (comment)


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@Kolobok12309 Kolobok12309 changed the title fix(plugin-vue/hmr): Add src urls to watcher fix(plugin-vue): Add src urls to watcher Feb 11, 2025
@Kolobok12309 Kolobok12309 changed the title fix(plugin-vue): Add src urls to watcher fix(plugin-vue): add src urls to watcher Feb 11, 2025
Copy link

pkg-pr-new bot commented Feb 11, 2025

Open in Stackblitz

npm i https://pkg.pr.new/@vitejs/plugin-vue@524
npm i https://pkg.pr.new/@vitejs/plugin-vue-jsx@524

commit: 521e71a

@edison1105 edison1105 added the p2-nice-to-have 🍰 Not breaking anything but nice to have (priority) label Feb 17, 2025
@edison1105
Copy link
Member

LGTM

@edison1105 edison1105 requested review from bluwy and antfu February 17, 2025 01:48
Make same as rollup-plugin-vue
@Kolobok12309 Kolobok12309 requested a review from bluwy February 17, 2025 06:22
@edison1105 edison1105 changed the title fix(plugin-vue): add src urls to watcher fix(plugin-vue): support external import URLs for monorepos Feb 17, 2025
@edison1105 edison1105 merged commit cdd4922 into vitejs:main Feb 17, 2025
9 checks passed
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo that referenced this pull request Mar 17, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#readme) ([source](https://github.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue)) | devDependencies | minor | [`5.1.5` -> `5.2.3`](https://renovatebot.com/diffs/npm/@vitejs%2fplugin-vue/5.1.5/5.2.3) |

---

### Release Notes

<details>
<summary>vitejs/vite-plugin-vue (@&#8203;vitejs/plugin-vue)</summary>

### [`v5.2.3`](https://github.com/vitejs/vite-plugin-vue/blob/HEAD/packages/plugin-vue/CHANGELOG.md#small523-2025-03-17-small)

-   Revert "fix: generate unique component id" ([#&#8203;548](vitejs/vite-plugin-vue#548)) ([4bc5517](vitejs/vite-plugin-vue@4bc5517)), closes [#&#8203;548](vitejs/vite-plugin-vue#548)

### [`v5.2.2`](https://github.com/vitejs/vite-plugin-vue/blob/HEAD/packages/plugin-vue/CHANGELOG.md#small522-2025-03-17-small)

-   feat: pass descriptor vapor flag to compileTemplte ([219e007](vitejs/vite-plugin-vue@219e007))
-   feat(css): tree shake scoped styles ([#&#8203;533](vitejs/vite-plugin-vue#533)) ([333094f](vitejs/vite-plugin-vue@333094f)), closes [#&#8203;533](vitejs/vite-plugin-vue#533)
-   fix: generate unique component id ([#&#8203;538](vitejs/vite-plugin-vue#538)) ([2704e85](vitejs/vite-plugin-vue@2704e85)), closes [#&#8203;538](vitejs/vite-plugin-vue#538)
-   fix: properly interpret boolean values in `define` ([#&#8203;545](vitejs/vite-plugin-vue#545)) ([46d3d65](vitejs/vite-plugin-vue@46d3d65)), closes [#&#8203;545](vitejs/vite-plugin-vue#545)
-   fix(deps): update all non-major dependencies ([#&#8203;482](vitejs/vite-plugin-vue#482)) ([cdbae68](vitejs/vite-plugin-vue@cdbae68)), closes [#&#8203;482](vitejs/vite-plugin-vue#482)
-   fix(deps): update all non-major dependencies ([#&#8203;488](vitejs/vite-plugin-vue#488)) ([5d39582](vitejs/vite-plugin-vue@5d39582)), closes [#&#8203;488](vitejs/vite-plugin-vue#488)
-   fix(index): move the if check earlier to avoid creating unnecessary ssr when entering return block ( ([2135c84](vitejs/vite-plugin-vue@2135c84)), closes [#&#8203;523](vitejs/vite-plugin-vue#523)
-   fix(plugin-vue): default value for compile time flags ([#&#8203;495](vitejs/vite-plugin-vue#495)) ([ae9d948](vitejs/vite-plugin-vue@ae9d948)), closes [#&#8203;495](vitejs/vite-plugin-vue#495)
-   fix(plugin-vue): ensure HMR updates styles when SFC is treated as a type dependency ([#&#8203;541](vitejs/vite-plugin-vue#541)) ([4abe3be](vitejs/vite-plugin-vue@4abe3be)), closes [#&#8203;541](vitejs/vite-plugin-vue#541)
-   fix(plugin-vue): resolve sourcemap conflicts in build watch mode with cached modules ([#&#8203;505](vitejs/vite-plugin-vue#505)) ([906cebb](vitejs/vite-plugin-vue@906cebb)), closes [#&#8203;505](vitejs/vite-plugin-vue#505)
-   fix(plugin-vue): support external import URLs for monorepos ([#&#8203;524](vitejs/vite-plugin-vue#524)) ([cdd4922](vitejs/vite-plugin-vue@cdd4922)), closes [#&#8203;524](vitejs/vite-plugin-vue#524)
-   fix(plugin-vue): support vapor template-only component ([#&#8203;529](vitejs/vite-plugin-vue#529)) ([95be153](vitejs/vite-plugin-vue@95be153)), closes [#&#8203;529](vitejs/vite-plugin-vue#529)
-   fix(plugin-vue): suppress warnings for non-recognized pseudo selectors form lightningcss ([#&#8203;521](vitejs/vite-plugin-vue#521)) ([15c0eb0](vitejs/vite-plugin-vue@15c0eb0)), closes [#&#8203;521](vitejs/vite-plugin-vue#521)
-   chore(deps): update dependency rollup to ^4.27.4 ([#&#8203;479](vitejs/vite-plugin-vue#479)) ([428320d](vitejs/vite-plugin-vue@428320d)), closes [#&#8203;479](vitejs/vite-plugin-vue#479)
-   chore(deps): update dependency rollup to ^4.28.1 ([#&#8203;484](vitejs/vite-plugin-vue#484)) ([388403f](vitejs/vite-plugin-vue@388403f)), closes [#&#8203;484](vitejs/vite-plugin-vue#484)
-   chore(deps): update dependency rollup to ^4.29.1 ([#&#8203;493](vitejs/vite-plugin-vue#493)) ([b092bc8](vitejs/vite-plugin-vue@b092bc8)), closes [#&#8203;493](vitejs/vite-plugin-vue#493)
-   chore(deps): update upstream ([#&#8203;503](vitejs/vite-plugin-vue#503)) ([8c12b9f](vitejs/vite-plugin-vue@8c12b9f)), closes [#&#8203;503](vitejs/vite-plugin-vue#503)
-   chore(deps): update upstream ([#&#8203;511](vitejs/vite-plugin-vue#511)) ([d057351](vitejs/vite-plugin-vue@d057351)), closes [#&#8203;511](vitejs/vite-plugin-vue#511)
-   chore(deps): update upstream ([#&#8203;526](vitejs/vite-plugin-vue#526)) ([59946d3](vitejs/vite-plugin-vue@59946d3)), closes [#&#8203;526](vitejs/vite-plugin-vue#526)
-   chore(plugin-vue): simplify `resolved` declaration ([7288a59](vitejs/vite-plugin-vue@7288a59))

### [`v5.2.1`](https://github.com/vitejs/vite-plugin-vue/blob/HEAD/packages/plugin-vue/CHANGELOG.md#small521-2024-11-26-small)

-   chore: add vite 6 peer dep ([#&#8203;481](vitejs/vite-plugin-vue#481)) ([4288652](vitejs/vite-plugin-vue@4288652)), closes [#&#8203;481](vitejs/vite-plugin-vue#481)
-   chore: fix lint ([378aea3](vitejs/vite-plugin-vue@378aea3))
-   chore(deps): update dependency rollup to ^4.27.2 ([#&#8203;476](vitejs/vite-plugin-vue#476)) ([b2df95e](vitejs/vite-plugin-vue@b2df95e)), closes [#&#8203;476](vitejs/vite-plugin-vue#476)

### [`v5.2.0`](https://github.com/vitejs/vite-plugin-vue/blob/HEAD/packages/plugin-vue/CHANGELOG.md#520-2024-11-13)

-   feat: add a feature option to support custom component id generator ([#&#8203;461](vitejs/vite-plugin-vue#461)) ([7a1fc4c](vitejs/vite-plugin-vue@7a1fc4c)), closes [#&#8203;461](vitejs/vite-plugin-vue#461)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* 0-3 * * *" (UTC), Automerge - "* 0-3 * * *" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [x] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOTUuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNS4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiLCJ0ZXN0L25vdC1uZWVkZWQiXX0=-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7248
Reviewed-by: Gusted <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have 🍰 Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add watchers to imports within vue files
3 participants