-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
fix(index): continue watching after dependency {Error}
#332
Conversation
{Error}
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.
👍 After Code Style fixes, I will land this
test/helpers/fileChange.js
Outdated
@@ -0,0 +1,31 @@ | |||
const path = require('path') |
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.
test/helpers/fileChange
=> test/helpers/fs
test/helpers/fileChange.js
Outdated
const wf = promisify(writeFile) | ||
const rm = promisify(unlink) | ||
|
||
function readCssFile (name) { |
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.
readCssFile
=> read
test/helpers/fileChange.js
Outdated
const rm = promisify(unlink) | ||
|
||
function readCssFile (name) { | ||
const fileName = path.join(__dirname, '../fixtures', name) |
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.
fileName
=> file
test/helpers/fileChange.js
Outdated
const fileName = path.join(__dirname, '../fixtures', name) | ||
|
||
return rf(fileName) | ||
.then(c => c.toString()) |
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.
c
=> content || data
test/helpers/fileChange.js
Outdated
.then(c => c.toString()) | ||
} | ||
|
||
function writeCssFile (name, contents) { |
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.
writeCssFile
=> write
test/loader.test.js
Outdated
(stats) => { | ||
const { err, src } = loader(stats) | ||
expect(src).toMatchSnapshot() | ||
expect(err.length).toEqual(0) |
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.
\n
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.
For each element in steps
please
test/loader.test.js
Outdated
var currentStep = 0 | ||
|
||
const options = { | ||
watching: true, |
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.
Either
const options = {
watch (err, stats, close) {
// ...handling
}
}
or
const options = {
watch: {
handler (err, stats, close) { // ...handling }
}
}
test/loader.test.js
Outdated
} | ||
} | ||
|
||
return webpack('css-watching/index.js', config, options) |
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.
css-watching
=> watch/watching
(Fixtures)
test/helpers/compiler.js
Outdated
if (err) reject(err) | ||
if (options.watching) { | ||
return new Promise((resolve, reject) => { | ||
const c = compiler.watch({}, (err, stats) => { |
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.
c
=> watcher
test/loader.test.js
Outdated
loader: { | ||
options: { | ||
plugins: [require("postcss-import")], | ||
watching: true |
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.
This should be config.watch(ing)
instead of config.loader.watch(ing)
?
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.
Good catch, it isn't needed at all since I'm calling .watch() on the compiler.
That should cover everything. |
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.
@zenbrent Thx. If you like PR the watch
logic of yours to webpack-contrib/test-utils
, otherwise I will 'steal this feature' 😛
Released in |
When you are watching a file that has dependancies (in my case, I was using the postcss-import module), and you save a file with a syntax error, the file watcher stops working.
This PR makes webpack continue watching in that case.
Type
SemVer
Issues
Couldn't find an issue for this.
Checklist