Title: How does watch mode work? · Issue #295 · unjs/unplugin · GitHub
Open Graph Title: How does watch mode work? · Issue #295 · unjs/unplugin
X Title: How does watch mode work? · Issue #295 · unjs/unplugin
Description: Environment node 18, webpack 5 Reproduction I have this plugin that I'm using in webpack: const { createUnplugin } = require('unplugin'); const copyToPublic = createUnplugin((options) => { let { src, include, dest } = options ?? {}; dest...
Open Graph Description: Environment node 18, webpack 5 Reproduction I have this plugin that I'm using in webpack: const { createUnplugin } = require('unplugin'); const copyToPublic = createUnplugin((options) => { let { sr...
X Description: Environment node 18, webpack 5 Reproduction I have this plugin that I'm using in webpack: const { createUnplugin } = require('unplugin'); const copyToPublic = createUnplugin((options) =...
Opengraph URL: https://github.com/unjs/unplugin/issues/295
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How does watch mode work?","articleBody":"### Environment\r\n\r\nnode 18, webpack 5\r\n\r\n### Reproduction\r\n\r\nI have this plugin that I'm using in webpack:\r\n```js\r\nconst { createUnplugin } = require('unplugin');\r\n\r\nconst copyToPublic = createUnplugin((options) => {\r\n let { src, include, dest } = options ?? {};\r\n\r\n dest ??= src;\r\n include ??= '**/*';\r\n\r\n return {\r\n name: 'copy-files-to-public',\r\n async buildStart() {\r\n const files = globby.sync(include, { cwd: src });\r\n\r\n await Promise.all(\r\n files.map(async (file) => {\r\n let source = path.join(src, file);\r\n\r\n this.addWatchFile(source);\r\n\r\n await this.emitFile({\r\n type: 'asset',\r\n fileName: path.join(dest, file),\r\n source: fs.readFileSync(source).toString(),\r\n });\r\n })\r\n );\r\n },\r\n };\r\n});\r\n```\r\n\r\nLike this:\r\n```js\r\n plugins: [\r\n copyToPublic.webpack({ src: 'docs' }),\r\n\r\n ],\r\n },\r\n```\r\n\r\n### Describe the bug\r\n\r\nwhen I tried to use the `watchChange` hook, it was never called (no console.log's were logged)\r\n(I made sure to change a few of the files found by globby)\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_","author":{"url":"https://github.com/NullVoxPopuli","@type":"Person","name":"NullVoxPopuli"},"datePublished":"2023-03-21T22:26:26Z","url":"https://github.com/unjs/unplugin/issues/295"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7a11caf0-dc6c-4557-c5f0-abf59e290726 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC5E:44D65:E13B56:12E89EE:6B005916 |
| html-safe-nonce | f2bbd366a12d251944740587bf0e8886cfef7521e72cd4487103afc2f3988337 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzVFOjQ0RDY1OkUxM0I1NjoxMkU4OUVFOjZCMDA1OTE2IiwidmlzaXRvcl9pZCI6IjQxMzA4Mzc1MTA1ODAzNjE0OTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9712fd3d303ae6d4d193e2cc606d6e837c69f64ffb4e6a9368226c0e54e5e7cf |
| hovercard-subject-tag | issue:1634779857 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unjs/unplugin/295/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5c49594381499eab2d08ad8332d9cbec9bd1c06d0a939f4b313f1cce261a482a/unjs/unplugin/issues/295 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5c49594381499eab2d08ad8332d9cbec9bd1c06d0a939f4b313f1cce261a482a/unjs/unplugin/issues/295 |
| og:image:alt | Environment node 18, webpack 5 Reproduction I have this plugin that I'm using in webpack: const { createUnplugin } = require('unplugin'); const copyToPublic = createUnplugin((options) => { let { sr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NullVoxPopuli |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| turbo-cache-control | no-preview |
| go-import | github.com/unjs/unplugin git https://github.com/unjs/unplugin.git |
| octolytics-dimension-user_id | 80154025 |
| octolytics-dimension-user_login | unjs |
| octolytics-dimension-repository_id | 385261169 |
| octolytics-dimension-repository_nwo | unjs/unplugin |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 385261169 |
| octolytics-dimension-repository_network_root_nwo | unjs/unplugin |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width