feat(node): expose webpack watchOptions to executor (#11453)
This commit is contained in:
parent
09112ccd24
commit
86b2015ddd
@ -302,6 +302,22 @@
|
||||
"description": "Run build when files change.",
|
||||
"default": false
|
||||
},
|
||||
"watchOptions": {
|
||||
"type": "object",
|
||||
"description": "A set of options used to customize watch mode.",
|
||||
"properties": {
|
||||
"aggregateTimeout": { "type": "integer" },
|
||||
"ignored": {
|
||||
"oneOf": [
|
||||
{ "type": "array", "items": { "type": "string" } },
|
||||
{ "type": "string" }
|
||||
]
|
||||
},
|
||||
"poll": { "type": "integer" },
|
||||
"followSymlinks": { "type": "boolean" },
|
||||
"stdin": { "type": "boolean" }
|
||||
}
|
||||
},
|
||||
"poll": {
|
||||
"type": "number",
|
||||
"description": "Frequency of file watcher in ms."
|
||||
|
||||
@ -26,6 +26,37 @@
|
||||
"description": "Run build when files change.",
|
||||
"default": false
|
||||
},
|
||||
"watchOptions": {
|
||||
"type": "object",
|
||||
"description": "A set of options used to customize watch mode.",
|
||||
"properties": {
|
||||
"aggregateTimeout": {
|
||||
"type": "integer"
|
||||
},
|
||||
"ignored": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"poll": {
|
||||
"type": "integer"
|
||||
},
|
||||
"followSymlinks": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"stdin": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"poll": {
|
||||
"type": "number",
|
||||
"description": "Frequency of file watcher in ms."
|
||||
|
||||
@ -84,6 +84,27 @@ describe('Node Build Executor', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should use watchOptions if passed in', async () => {
|
||||
await webpackExecutor(
|
||||
{
|
||||
...options,
|
||||
watchOptions: {
|
||||
ignored: ['path1'],
|
||||
},
|
||||
},
|
||||
context
|
||||
).next();
|
||||
|
||||
expect(runWebpack).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
watchOptions: {
|
||||
ignored: ['path1'],
|
||||
aggregateTimeout: 200,
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
describe('webpackConfig', () => {
|
||||
it('should handle custom path', async () => {
|
||||
jest.mock(
|
||||
|
||||
@ -113,6 +113,7 @@ export function getBaseWebpackPartial(
|
||||
// two builds on a single file change.
|
||||
aggregateTimeout: 200,
|
||||
poll: options.poll,
|
||||
...options.watchOptions,
|
||||
},
|
||||
stats: getStatsConfig(options),
|
||||
experiments: {
|
||||
|
||||
@ -59,11 +59,20 @@ export interface AdditionalEntryPoint {
|
||||
entryPath: string;
|
||||
}
|
||||
|
||||
export interface WebpackWatchOptions {
|
||||
aggregateTimeout?: number;
|
||||
ignored?: Array<string> | string;
|
||||
poll?: number;
|
||||
followSymlinks?: boolean;
|
||||
stdin?: boolean;
|
||||
}
|
||||
|
||||
export interface BuildBuilderOptions {
|
||||
main: string;
|
||||
outputPath: string;
|
||||
tsConfig: string;
|
||||
watch?: boolean;
|
||||
watchOptions?: WebpackWatchOptions;
|
||||
sourceMap?: boolean | SourceMapOptions;
|
||||
optimization?: boolean | OptimizationOptions;
|
||||
maxWorkers?: number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user