From c7ccb957e75eb52bb0fa7a900a4d063b79f1690d Mon Sep 17 00:00:00 2001 From: Brent Date: Wed, 31 Jan 2018 18:44:02 -0600 Subject: [PATCH 1/6] When an error occurs, keep watching the dependancy. --- lib/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/index.js b/lib/index.js index a4ef3a90..76f09fb8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -186,6 +186,7 @@ module.exports = function loader (css, map) { return null }) }).catch((err) => { + if (err.file) { this.addDependency(err.file) } return err.name === 'CssSyntaxError' ? cb(new SyntaxError(err)) : cb(err) }) } From ce7802eea9352de01697c5b7a8ecabe8d97d51b6 Mon Sep 17 00:00:00 2001 From: Brent Brimhall Date: Thu, 1 Feb 2018 13:59:41 -0600 Subject: [PATCH 2/6] Added tests --- package.json | 1 + test/__snapshots__/loader.test.js.snap | 6 ++ test/fixtures/css-watching/index.js | 3 + test/fixtures/css-watching/noSyntaxError.css | 1 + test/fixtures/css-watching/style.css | 1 + test/fixtures/css-watching/syntaxError.css | 1 + test/helpers/compiler.js | 20 +++++-- test/helpers/fileChange.js | 31 ++++++++++ test/loader.test.js | 59 ++++++++++++++++++++ 9 files changed, 118 insertions(+), 5 deletions(-) create mode 100644 test/fixtures/css-watching/index.js create mode 100644 test/fixtures/css-watching/noSyntaxError.css create mode 100644 test/fixtures/css-watching/style.css create mode 100644 test/fixtures/css-watching/syntaxError.css create mode 100644 test/helpers/fileChange.js diff --git a/package.json b/package.json index 31408441..090f08e9 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "jest": "^21.0.0", "jsdoc-to-markdown": "^3.0.0", "memory-fs": "^0.4.0", + "postcss-import": "^11.0.0", "postcss-js": "^1.0.0", "standard": "^10.0.0", "standard-version": "^4.0.0", diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 97a69ae8..0ff6f3f1 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -1,3 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Loader Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; + +exports[`Loader Watching Deps After An Error Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; + +exports[`Loader Watching Deps After An Error Default 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`; + +exports[`Loader Watching Deps After An Error Default 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`; diff --git a/test/fixtures/css-watching/index.js b/test/fixtures/css-watching/index.js new file mode 100644 index 00000000..61e122b2 --- /dev/null +++ b/test/fixtures/css-watching/index.js @@ -0,0 +1,3 @@ +import style from './style.css' + +export default style diff --git a/test/fixtures/css-watching/noSyntaxError.css b/test/fixtures/css-watching/noSyntaxError.css new file mode 100644 index 00000000..fa33ad5f --- /dev/null +++ b/test/fixtures/css-watching/noSyntaxError.css @@ -0,0 +1 @@ +a { color: black } diff --git a/test/fixtures/css-watching/style.css b/test/fixtures/css-watching/style.css new file mode 100644 index 00000000..bee68e0d --- /dev/null +++ b/test/fixtures/css-watching/style.css @@ -0,0 +1 @@ +@import "./styleDep"; diff --git a/test/fixtures/css-watching/syntaxError.css b/test/fixtures/css-watching/syntaxError.css new file mode 100644 index 00000000..4943cb88 --- /dev/null +++ b/test/fixtures/css-watching/syntaxError.css @@ -0,0 +1 @@ +a { color black } diff --git a/test/helpers/compiler.js b/test/helpers/compiler.js index 8618632c..282470cd 100644 --- a/test/helpers/compiler.js +++ b/test/helpers/compiler.js @@ -43,11 +43,21 @@ module.exports = function compiler (fixture, config, options) { if (!options.emit) compiler.outputFileSystem = new MemoryFS() - return new Promise((resolve, reject) => { - return compiler.run((err, stats) => { - if (err) reject(err) + if (options.watching) { + return new Promise((resolve, reject) => { + const c = compiler.watch({}, (err, stats) => { + options.handler(err, stats, (s) => { + c.close(resolve) + }) + }) + }) + } else { + return new Promise((resolve, reject) => { + return compiler.run((err, stats) => { + if (err) reject(err) - resolve(stats) + resolve(stats) + }) }) - }) + } } diff --git a/test/helpers/fileChange.js b/test/helpers/fileChange.js new file mode 100644 index 00000000..1677db8a --- /dev/null +++ b/test/helpers/fileChange.js @@ -0,0 +1,31 @@ +const path = require('path') +const { readFile, writeFile, unlink } = require('fs') +const { promisify } = require('util') + +const rf = promisify(readFile) +const wf = promisify(writeFile) +const rm = promisify(unlink) + +function readCssFile (name) { + const fileName = path.join(__dirname, '../fixtures', name) + + return rf(fileName) + .then(c => c.toString()) +} + +function writeCssFile (name, contents) { + const fileName = path.join(__dirname, '../fixtures', name) + + return wf(fileName, contents) +} + +module.exports.copyCssFile = function copyCssFile (src, dest) { + return readCssFile(src) + .then(contents => writeCssFile(dest, contents)) +} + +module.exports.deleteCssFile = function deleteCssFile (name) { + const fileName = path.join(__dirname, '../fixtures', name) + + return rm(fileName) +} diff --git a/test/loader.test.js b/test/loader.test.js index 57e8ffcd..f12f7e0a 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -2,6 +2,7 @@ const webpack = require('./helpers/compiler') const { loader } = require('./helpers/compilation') +const { copyCssFile, deleteCssFile } = require('./helpers/fileChange'); describe('Loader', () => { test('Default', () => { @@ -20,4 +21,62 @@ describe('Loader', () => { expect(src).toMatchSnapshot() }) }) + + describe('Watching Deps After An Error', () => { + const files = { + syntaxError: "css-watching/syntaxError.css", + noSyntaxError: "css-watching/noSyntaxError.css", + changingFile: "css-watching/styleDep.css" + } + + beforeAll(() => copyCssFile(files.noSyntaxError, files.changingFile)) + + afterAll(() => deleteCssFile(files.changingFile)) + + test('Default', () => { + const config = { + loader: { + options: { + plugins: [require("postcss-import")], + watching: true + } + } + } + + const testSteps = [ + (stats) => { + const { err, src } = loader(stats) + expect(src).toMatchSnapshot() + expect(err.length).toEqual(0) + return copyCssFile(files.syntaxError, files.changingFile) + }, + (stats) => { + const { err, src } = loader(stats) + expect(src).toMatchSnapshot() + expect(err.length).toEqual(1) + return copyCssFile(files.noSyntaxError, files.changingFile) + }, + (stats, close) => { + const { err, src } = loader(stats) + expect(src).toMatchSnapshot() + expect(src).toEqual("module.exports = \"a { color: black }\\n\"") + expect(err.length).toEqual(0) + return close() + } + ]; + + var currentStep = 0 + + const options = { + watching: true, + handler: (err, stats, close) => { + testSteps[currentStep](stats, close) + currentStep++ + } + } + + return webpack('css-watching/index.js', config, options) + }) + }) + }) From d64b26e0a60701cf96e256aed3e0518210e19192 Mon Sep 17 00:00:00 2001 From: Brent Brimhall Date: Thu, 1 Feb 2018 14:30:21 -0600 Subject: [PATCH 3/6] util.promisify doesn't exist on node v6 --- package.json | 1 + test/helpers/fileChange.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 090f08e9..907bb447 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "standard": "^10.0.0", "standard-version": "^4.0.0", "sugarss": "^1.0.0", + "util.promisify": "^1.0.0", "webpack": "^3.0.0" }, "scripts": { diff --git a/test/helpers/fileChange.js b/test/helpers/fileChange.js index 1677db8a..8e75096e 100644 --- a/test/helpers/fileChange.js +++ b/test/helpers/fileChange.js @@ -1,6 +1,6 @@ const path = require('path') const { readFile, writeFile, unlink } = require('fs') -const { promisify } = require('util') +const promisify = require('util.promisify') const rf = promisify(readFile) const wf = promisify(writeFile) From b1b97d40f1d7c92d023b1a9297c5a6c186aa702d Mon Sep 17 00:00:00 2001 From: Brent Brimhall Date: Thu, 1 Feb 2018 17:16:08 -0600 Subject: [PATCH 4/6] File moves --- test/fixtures/{css-watching => watch/watching}/index.js | 0 test/fixtures/{css-watching => watch/watching}/noSyntaxError.css | 0 test/fixtures/{css-watching => watch/watching}/style.css | 0 test/fixtures/{css-watching => watch/watching}/syntaxError.css | 0 test/helpers/{fileChange.js => fs.js} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename test/fixtures/{css-watching => watch/watching}/index.js (100%) rename test/fixtures/{css-watching => watch/watching}/noSyntaxError.css (100%) rename test/fixtures/{css-watching => watch/watching}/style.css (100%) rename test/fixtures/{css-watching => watch/watching}/syntaxError.css (100%) rename test/helpers/{fileChange.js => fs.js} (100%) diff --git a/test/fixtures/css-watching/index.js b/test/fixtures/watch/watching/index.js similarity index 100% rename from test/fixtures/css-watching/index.js rename to test/fixtures/watch/watching/index.js diff --git a/test/fixtures/css-watching/noSyntaxError.css b/test/fixtures/watch/watching/noSyntaxError.css similarity index 100% rename from test/fixtures/css-watching/noSyntaxError.css rename to test/fixtures/watch/watching/noSyntaxError.css diff --git a/test/fixtures/css-watching/style.css b/test/fixtures/watch/watching/style.css similarity index 100% rename from test/fixtures/css-watching/style.css rename to test/fixtures/watch/watching/style.css diff --git a/test/fixtures/css-watching/syntaxError.css b/test/fixtures/watch/watching/syntaxError.css similarity index 100% rename from test/fixtures/css-watching/syntaxError.css rename to test/fixtures/watch/watching/syntaxError.css diff --git a/test/helpers/fileChange.js b/test/helpers/fs.js similarity index 100% rename from test/helpers/fileChange.js rename to test/helpers/fs.js From fe5a8b598f6b9387f937898c470990c481f00cb3 Mon Sep 17 00:00:00 2001 From: Brent Brimhall Date: Thu, 1 Feb 2018 17:19:20 -0600 Subject: [PATCH 5/6] Code style fixes --- lib/index.js | 2 +- test/__snapshots__/loader.test.js.snap | 6 ++--- test/helpers/compiler.js | 8 +++--- test/helpers/fs.js | 36 ++++++++++++++------------ test/loader.test.js | 35 +++++++++++++------------ 5 files changed, 46 insertions(+), 41 deletions(-) diff --git a/lib/index.js b/lib/index.js index 76f09fb8..95c6a65b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -186,7 +186,7 @@ module.exports = function loader (css, map) { return null }) }).catch((err) => { - if (err.file) { this.addDependency(err.file) } + if (err.file) this.addDependency(err.file) return err.name === 'CssSyntaxError' ? cb(new SyntaxError(err)) : cb(err) }) } diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 0ff6f3f1..1b8ea66f 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -2,8 +2,8 @@ exports[`Loader Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; -exports[`Loader Watching Deps After An Error Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; +exports[`Loader Watching Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; -exports[`Loader Watching Deps After An Error Default 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`; +exports[`Loader Watching Default 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`; -exports[`Loader Watching Deps After An Error Default 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`; +exports[`Loader Watching Default 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`; diff --git a/test/helpers/compiler.js b/test/helpers/compiler.js index 282470cd..cbbfb32c 100644 --- a/test/helpers/compiler.js +++ b/test/helpers/compiler.js @@ -43,11 +43,11 @@ module.exports = function compiler (fixture, config, options) { if (!options.emit) compiler.outputFileSystem = new MemoryFS() - if (options.watching) { + if (options.watch) { return new Promise((resolve, reject) => { - const c = compiler.watch({}, (err, stats) => { - options.handler(err, stats, (s) => { - c.close(resolve) + const watcher = compiler.watch({}, (err, stats) => { + options.watch(err, stats, (s) => { + watcher.close(resolve) }) }) }) diff --git a/test/helpers/fs.js b/test/helpers/fs.js index 8e75096e..1a670be3 100644 --- a/test/helpers/fs.js +++ b/test/helpers/fs.js @@ -1,31 +1,33 @@ const path = require('path') -const { readFile, writeFile, unlink } = require('fs') +const { readFile: _readFile, writeFile: _writeFile, unlink: _unlink } = require('fs') const promisify = require('util.promisify') -const rf = promisify(readFile) -const wf = promisify(writeFile) -const rm = promisify(unlink) +const fs = { + readFile: promisify(_readFile), + writeFile: promisify(_writeFile), + unlink: promisify(_unlink) +} -function readCssFile (name) { - const fileName = path.join(__dirname, '../fixtures', name) +function readFile (name) { + const file = path.join(__dirname, '../fixtures', name) - return rf(fileName) - .then(c => c.toString()) + return fs.readFile(file) + .then(data => data.toString()) } -function writeCssFile (name, contents) { - const fileName = path.join(__dirname, '../fixtures', name) +function writeFile (name, contents) { + const file = path.join(__dirname, '../fixtures', name) - return wf(fileName, contents) + return fs.writeFile(file, contents) } -module.exports.copyCssFile = function copyCssFile (src, dest) { - return readCssFile(src) - .then(contents => writeCssFile(dest, contents)) +module.exports.copyFile = function copyFile (src, dest) { + return readFile(src) + .then(contents => writeFile(dest, contents)) } -module.exports.deleteCssFile = function deleteCssFile (name) { - const fileName = path.join(__dirname, '../fixtures', name) +module.exports.deleteFile = function deleteFile (name) { + const file = path.join(__dirname, '../fixtures', name) - return rm(fileName) + return fs.unlink(file) } diff --git a/test/loader.test.js b/test/loader.test.js index f12f7e0a..342b5b56 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -2,7 +2,7 @@ const webpack = require('./helpers/compiler') const { loader } = require('./helpers/compilation') -const { copyCssFile, deleteCssFile } = require('./helpers/fileChange'); +const { copyFile, deleteFile } = require('./helpers/fs'); describe('Loader', () => { test('Default', () => { @@ -22,45 +22,50 @@ describe('Loader', () => { }) }) - describe('Watching Deps After An Error', () => { + describe('Watching', () => { const files = { - syntaxError: "css-watching/syntaxError.css", - noSyntaxError: "css-watching/noSyntaxError.css", - changingFile: "css-watching/styleDep.css" + syntaxError: "watch/watching/syntaxError.css", + noSyntaxError: "watch/watching/noSyntaxError.css", + changingFile: "watch/watching/styleDep.css" } - beforeAll(() => copyCssFile(files.noSyntaxError, files.changingFile)) + beforeAll(() => copyFile(files.noSyntaxError, files.changingFile)) - afterAll(() => deleteCssFile(files.changingFile)) + afterAll(() => deleteFile(files.changingFile)) test('Default', () => { const config = { loader: { options: { plugins: [require("postcss-import")], - watching: true } } } - const testSteps = [ + const steps = [ (stats) => { const { err, src } = loader(stats) + expect(src).toMatchSnapshot() expect(err.length).toEqual(0) - return copyCssFile(files.syntaxError, files.changingFile) + + return copyFile(files.syntaxError, files.changingFile) }, (stats) => { const { err, src } = loader(stats) + expect(src).toMatchSnapshot() expect(err.length).toEqual(1) - return copyCssFile(files.noSyntaxError, files.changingFile) + + return copyFile(files.noSyntaxError, files.changingFile) }, (stats, close) => { const { err, src } = loader(stats) + expect(src).toMatchSnapshot() expect(src).toEqual("module.exports = \"a { color: black }\\n\"") expect(err.length).toEqual(0) + return close() } ]; @@ -68,15 +73,13 @@ describe('Loader', () => { var currentStep = 0 const options = { - watching: true, - handler: (err, stats, close) => { - testSteps[currentStep](stats, close) + watch (err, stats, close) { + steps[currentStep](stats, close) currentStep++ } } - return webpack('css-watching/index.js', config, options) + return webpack('watch/watching/index.js', config, options) }) }) - }) From 6a6968dca5d9ec6559ad5379e77bcbafb7f88dd2 Mon Sep 17 00:00:00 2001 From: Brent Brimhall Date: Thu, 1 Feb 2018 17:27:17 -0600 Subject: [PATCH 6/6] Code style fixes --- test/__snapshots__/loader.test.js.snap | 6 +- test/loader.test.js | 84 +++++++++++++------------- 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index 1b8ea66f..b88ef9ef 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -2,8 +2,8 @@ exports[`Loader Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; -exports[`Loader Watching Default 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; +exports[`Loader Watching Dependencies Error 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; -exports[`Loader Watching Default 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`; +exports[`Loader Watching Dependencies Error 2`] = `"throw new Error(\\"Module build failed: Syntax Error \\\\n\\\\n(1:5) Unknown word\\\\n\\\\n\\\\u001b[31m\\\\u001b[1m>\\\\u001b[22m\\\\u001b[39m\\\\u001b[90m 1 | \\\\u001b[39ma \\\\u001b[33m{\\\\u001b[39m color black \\\\u001b[33m}\\\\u001b[39m\\\\n \\\\u001b[90m | \\\\u001b[39m \\\\u001b[31m\\\\u001b[1m^\\\\u001b[22m\\\\u001b[39m\\\\n \\\\u001b[90m 2 | \\\\u001b[39m\\\\n\\");"`; -exports[`Loader Watching Default 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`; +exports[`Loader Watching Dependencies Error 3`] = `"module.exports = \\"a { color: black }\\\\n\\""`; diff --git a/test/loader.test.js b/test/loader.test.js index 342b5b56..7fbafe5b 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -23,63 +23,65 @@ describe('Loader', () => { }) describe('Watching', () => { - const files = { - syntaxError: "watch/watching/syntaxError.css", - noSyntaxError: "watch/watching/noSyntaxError.css", - changingFile: "watch/watching/styleDep.css" - } + describe('Dependencies', () => { + const files = { + syntaxError: "watch/watching/syntaxError.css", + noSyntaxError: "watch/watching/noSyntaxError.css", + changingFile: "watch/watching/styleDep.css" + } - beforeAll(() => copyFile(files.noSyntaxError, files.changingFile)) + beforeEach(() => copyFile(files.noSyntaxError, files.changingFile)) - afterAll(() => deleteFile(files.changingFile)) + afterEach(() => deleteFile(files.changingFile)) - test('Default', () => { - const config = { - loader: { - options: { - plugins: [require("postcss-import")], + test('Error', () => { + const config = { + loader: { + options: { + plugins: [require("postcss-import")], + } } } - } - const steps = [ - (stats) => { - const { err, src } = loader(stats) + const steps = [ + (stats) => { + const { err, src } = loader(stats) - expect(src).toMatchSnapshot() - expect(err.length).toEqual(0) + expect(src).toMatchSnapshot() + expect(err.length).toEqual(0) - return copyFile(files.syntaxError, files.changingFile) - }, - (stats) => { - const { err, src } = loader(stats) + return copyFile(files.syntaxError, files.changingFile) + }, + (stats) => { + const { err, src } = loader(stats) - expect(src).toMatchSnapshot() - expect(err.length).toEqual(1) + expect(src).toMatchSnapshot() + expect(err.length).toEqual(1) - return copyFile(files.noSyntaxError, files.changingFile) - }, - (stats, close) => { - const { err, src } = loader(stats) + return copyFile(files.noSyntaxError, files.changingFile) + }, + (stats, close) => { + const { err, src } = loader(stats) - expect(src).toMatchSnapshot() - expect(src).toEqual("module.exports = \"a { color: black }\\n\"") - expect(err.length).toEqual(0) + expect(src).toMatchSnapshot() + expect(src).toEqual("module.exports = \"a { color: black }\\n\"") + expect(err.length).toEqual(0) - return close() - } - ]; + return close() + } + ]; - var currentStep = 0 + var currentStep = 0 - const options = { - watch (err, stats, close) { - steps[currentStep](stats, close) - currentStep++ + const options = { + watch (err, stats, close) { + steps[currentStep](stats, close) + currentStep++ + } } - } - return webpack('watch/watching/index.js', config, options) + return webpack('watch/watching/index.js', config, options) + }) }) }) })