@quicktvui/web-cli 1.0.0-beta.27 → 1.0.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/qt-web-cli.js +10 -6
  2. package/package.json +2 -2
package/bin/qt-web-cli.js CHANGED
@@ -191,18 +191,22 @@ function startDevServer(configPath, port, shouldOpen) {
191
191
  const compiler = webpack(config)
192
192
  const server = new WebpackDevServer(config.devServer, compiler)
193
193
 
194
+ // 监听编译完成事件,在首次编译完成后打开浏览器
195
+ let isOpened = false
196
+ compiler.hooks.done.tap('open-browser', (stats) => {
197
+ if (!isOpened && shouldOpen) {
198
+ isOpened = true
199
+ const url = `http://localhost:${port}`
200
+ openOrRefreshBrowser(url)
201
+ }
202
+ })
203
+
194
204
  server.startCallback((err) => {
195
205
  if (err) {
196
206
  signale.error('启动开发服务器失败:', err.message)
197
207
  process.exit(1)
198
208
  }
199
209
  signale.success(`开发服务器已启动: http://localhost:${port}`)
200
-
201
- // 打开浏览器
202
- if (shouldOpen) {
203
- const url = `http://localhost:${port}`
204
- openOrRefreshBrowser(url)
205
- }
206
210
  })
207
211
 
208
212
  // 处理退出信号
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quicktvui/web-cli",
3
- "version": "1.0.0-beta.27",
3
+ "version": "1.0.0-beta.29",
4
4
  "description": "CLI tool for QuickTVUI web development - zero configuration",
5
5
  "author": "QuickTVUI Team",
6
6
  "license": "Apache-2.0",
@@ -24,7 +24,7 @@
24
24
  "minimist": "^1.2.8",
25
25
  "shelljs": "^0.10.0",
26
26
  "signale": "^1.4.0",
27
- "@quicktvui/web-renderer": "^1.0.8",
27
+ "@quicktvui/web-renderer": "^1.0.9",
28
28
  "scope-loader": "^1.0.3",
29
29
  "webpack": "^5.89.0",
30
30
  "webpack-cli": "^5.1.0",