diff --git a/README.md b/README.md index 3544c71..578b0b9 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,13 @@ module.exports = { // path.resolve(__dirname, "another-crate/src") // ], + // The options for `watchpack` constructor. + // Defaults to `{}`. + // watchOptions: { + // poll: true, + // ignored: /heavy_directory/, + // }, + // The same as the `--out-dir` option for `wasm-pack` // outDir: "pkg", diff --git a/package.json b/package.json index 883b31e..0f7bb31 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ }, "devDependencies": { "@types/webpack": "*", + "@types/watchpack": "*", "prettier": "^2.4.1" } } diff --git a/plugin.d.ts b/plugin.d.ts index 764cc89..5f657be 100644 --- a/plugin.d.ts +++ b/plugin.d.ts @@ -1,4 +1,5 @@ import { Compiler } from 'webpack' +import { WatchOptions } from 'watchpack' export interface WasmPackPluginOptions { crateDirectory: string @@ -9,6 +10,7 @@ export interface WasmPackPluginOptions { outDir?: string outName?: string watchDirectories?: string[] + watchOptions?: WatchOptions /** Controls plugin output verbosity. Defaults to 'info'. */ pluginLogLevel?: 'info' | 'error' } diff --git a/plugin.js b/plugin.js index df1597d..276a476 100644 --- a/plugin.js +++ b/plugin.js @@ -61,7 +61,7 @@ class WasmPackPlugin { info = () => {} } - this.wp = new Watchpack() + this.wp = new Watchpack(options.watchOptions || {}) this.isDebug = true this.error = null }