Skip to content

Commit 96e40bb

Browse files
committed
Support webpack 4
1 parent c27f02c commit 96e40bb

File tree

4 files changed

+894
-172
lines changed

4 files changed

+894
-172
lines changed

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@
1818
"fs-extra": "^4.0.2",
1919
"lodash.camelcase": "^4.3.0"
2020
},
21+
"jest": {
22+
"testEnvironment": "node"
23+
},
2124
"devDependencies": {
2225
"@launchpadlab/babel-preset": "^1.0.0",
2326
"@launchpadlab/eslint-config": "^2.1.0",
27+
"babel-core": "^6.26.0",
2428
"babel-eslint": "^8.0.1",
25-
"babel-loader": "^7.1.2",
29+
"babel-loader": "^7.1.4",
2630
"eslint": "^4.10.0",
2731
"jest": "^21.2.1",
28-
"webpack": "^3.8.1"
32+
"webpack": "^4.0.0"
33+
},
34+
"peerDependencies": {
35+
"webpack": "^4.0.0"
2936
}
3037
}

src/dot-index-plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ DotIndexPlugin.prototype.apply = function (compiler) {
1313
function recompile () {
1414
return compiler.run(() => {})
1515
}
16-
compiler.plugin('watch-run', (compilation, callback) => {
16+
compiler.hooks.watchRun.tapAsync('DotIndexPlugin', (compilation, callback) => {
1717
createDotIndexFiles(rootPath)
1818
// Only initialize once
1919
if (this.initialized) return callback()
@@ -25,7 +25,7 @@ DotIndexPlugin.prototype.apply = function (compiler) {
2525
callback()
2626
})
2727
})
28-
compiler.plugin('run', (compilation, callback) => {
28+
compiler.hooks.run.tapAsync('DotIndexPlugin', (compilation, callback) => {
2929
createDotIndexFiles(rootPath)
3030
callback()
3131
})

test/dot-index-plugin/dot-index-plugin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test('Generates dot index files', end => {
3333
expect(err).toEqual(null)
3434
const modules = stats.toJson().modules
3535
expect(modules.length).toEqual(4)
36-
const indexFileContent = modules[0].source
36+
const indexFileContent = modules.pop().source
3737
expect(indexFileContent).toMatchSnapshot()
3838
end()
3939
})

0 commit comments

Comments
 (0)