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.",
|
"description": "Run build when files change.",
|
||||||
"default": false
|
"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": {
|
"poll": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Frequency of file watcher in ms."
|
"description": "Frequency of file watcher in ms."
|
||||||
|
|||||||
@ -26,6 +26,37 @@
|
|||||||
"description": "Run build when files change.",
|
"description": "Run build when files change.",
|
||||||
"default": false
|
"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": {
|
"poll": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Frequency of file watcher in ms."
|
"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', () => {
|
describe('webpackConfig', () => {
|
||||||
it('should handle custom path', async () => {
|
it('should handle custom path', async () => {
|
||||||
jest.mock(
|
jest.mock(
|
||||||
|
|||||||
@ -113,6 +113,7 @@ export function getBaseWebpackPartial(
|
|||||||
// two builds on a single file change.
|
// two builds on a single file change.
|
||||||
aggregateTimeout: 200,
|
aggregateTimeout: 200,
|
||||||
poll: options.poll,
|
poll: options.poll,
|
||||||
|
...options.watchOptions,
|
||||||
},
|
},
|
||||||
stats: getStatsConfig(options),
|
stats: getStatsConfig(options),
|
||||||
experiments: {
|
experiments: {
|
||||||
|
|||||||
@ -59,11 +59,20 @@ export interface AdditionalEntryPoint {
|
|||||||
entryPath: string;
|
entryPath: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface WebpackWatchOptions {
|
||||||
|
aggregateTimeout?: number;
|
||||||
|
ignored?: Array<string> | string;
|
||||||
|
poll?: number;
|
||||||
|
followSymlinks?: boolean;
|
||||||
|
stdin?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface BuildBuilderOptions {
|
export interface BuildBuilderOptions {
|
||||||
main: string;
|
main: string;
|
||||||
outputPath: string;
|
outputPath: string;
|
||||||
tsConfig: string;
|
tsConfig: string;
|
||||||
watch?: boolean;
|
watch?: boolean;
|
||||||
|
watchOptions?: WebpackWatchOptions;
|
||||||
sourceMap?: boolean | SourceMapOptions;
|
sourceMap?: boolean | SourceMapOptions;
|
||||||
optimization?: boolean | OptimizationOptions;
|
optimization?: boolean | OptimizationOptions;
|
||||||
maxWorkers?: number;
|
maxWorkers?: number;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user