-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(watch): add skipWrite
option
#3454
Changes from 3 commits
d7b22a3
c1e9b16
b544016
c45d994
d8a2aa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,6 +182,7 @@ const watchOptions = { | |
watch: { | ||
chokidar, | ||
clearScreen, | ||
skipWrite, | ||
exclude, | ||
include | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,10 +361,10 @@ export default { | |
onwarn (warning, warn) { | ||
// skip certain warnings | ||
if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return; | ||
|
||
// throw on others | ||
if (warning.code === 'NON_EXISTENT_EXPORT') throw new Error(warning.message); | ||
|
||
// Use default for everything else | ||
warn(warning); | ||
} | ||
|
@@ -754,7 +754,7 @@ Type: `boolean`<br> | |
CLI: `--externalLiveBindings`/`--no-externalLiveBindings`<br> | ||
Default: `true` | ||
|
||
When set to `false`, Rollup will not generate code to support live bindings for external imports but instead assume that exports do not change over time. This will enable Rollup to generate more optimized code. Note that this can cause issues when there are circular dependencies involving an external dependency. | ||
When set to `false`, Rollup will not generate code to support live bindings for external imports but instead assume that exports do not change over time. This will enable Rollup to generate more optimized code. Note that this can cause issues when there are circular dependencies involving an external dependency. | ||
|
||
This will avoid most cases where Rollup generates getters in the code and can therefore be used to make code IE8 compatible in many cases. | ||
|
||
|
@@ -1005,11 +1005,11 @@ function test(callback) { | |
// calls to otherwise side-effect-free global functions are retained | ||
// inside try-statements for tryCatchDeoptimization: true | ||
Object.create(null); | ||
|
||
// calls to other function are retained as well but the body of this | ||
// function may again be subject to tree-shaking | ||
otherFn(); | ||
|
||
// if a parameter is called, then all arguments passed to that function | ||
// parameter will be deoptimized | ||
callback(); | ||
|
@@ -1096,6 +1096,13 @@ Default: `true` | |
|
||
Whether to clear the screen when a rebuild is triggered. | ||
|
||
#### watch.skipWrite | ||
Type: `boolean`<br> | ||
<!-- CLI: `--watch.skipWrite`<br> --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This CLI option will work, but I figure it's better not to list it (similar to |
||
Default: `false` | ||
|
||
Whether to skip the `bundle.write()` step when a rebuild is triggered. | ||
|
||
#### watch.exclude | ||
Type: `string`<br> | ||
CLI: `--watch.exclude <excludedPattern>` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,7 @@ export class Task { | |
private invalidated = true; | ||
private outputFiles: string[]; | ||
private outputs: OutputOptions[]; | ||
private skipWrite: boolean; | ||
private watched: Set<string>; | ||
private watcher: Watcher; | ||
|
||
|
@@ -117,6 +118,7 @@ export class Task { | |
this.closed = false; | ||
this.watched = new Set(); | ||
|
||
this.skipWrite = config.watch && !!(config.watch as GenericConfigObject).skipWrite; | ||
const { inputOptions, outputOptions } = mergeOptions(config); | ||
this.inputOptions = inputOptions; | ||
this.outputs = outputOptions; | ||
|
@@ -174,7 +176,7 @@ export class Task { | |
return; | ||
} | ||
this.updateWatchedFiles(result); | ||
await Promise.all(this.outputs.map(output => result.write(output))); | ||
this.skipWrite || (await Promise.all(this.outputs.map(output => result.write(output)))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where the new option is applied. (Not a fan of how the linter formatted it) |
||
this.watcher.emit('event', { | ||
code: 'BUNDLE_END', | ||
duration: Date.now() - start, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 42; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, these look to be my editor's auto-trimming