diff --git a/docs/config.md b/docs/config.md index d6c2ed2dc..1ef415a40 100644 --- a/docs/config.md +++ b/docs/config.md @@ -520,7 +520,7 @@ Whether to output umd format. ### watch -- Type: `{ ignorePaths: string[] }` +- Type: `{ ignorePaths: string[] } | false` - Default: `{ ignorePaths: [] }` Watch related configuration. diff --git a/packages/bundler-mako/index.js b/packages/bundler-mako/index.js index 3d9721dd3..d7458c88f 100644 --- a/packages/bundler-mako/index.js +++ b/packages/bundler-mako/index.js @@ -43,11 +43,11 @@ exports.build = async function (opts) { math: opts.config.lessLoader?.math, plugins: opts.config.lessLoader?.plugins, }, - hooks: { - ...opts.config.hooks, - }, + plugins: opts.plugins || [], forkTSChecker: makoConfig.forkTSChecker, - watch: false, + watch: opts.watch || false, + hmr: opts.hmr || false, + devServer: opts.devServer || false, }); } catch (e) { console.error(e.message); @@ -213,12 +213,13 @@ exports.dev = async function (opts) { plugins: opts.config.lessLoader?.plugins, }, forkTSChecker: makoConfig.forkTSChecker, - hooks: { + plugins: (opts.plugins || []).concat({ + name: 'default', generateEnd: (args) => { opts.onDevCompileDone(args); }, - ...opts.config.hooks, - }, + }), + watch: true, }); } catch (e) {