Skip to content

Commit 983e08f

Browse files
authored
Chore: Support Webpack 5 (#15)
* Update version and peer dependencies * Update dev dependencies and tests * Add mode * Remove unnecessary comma * Update noder version
1 parent 49673ea commit 983e08f

File tree

4 files changed

+2307
-3249
lines changed

4 files changed

+2307
-3249
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- '8'
3+
- '16'
44
notifications:
55
email: false
66
deploy:

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dot-index-webpack-plugin",
3-
"version": "5.2.0",
3+
"version": "5.3.0",
44
"description": "",
55
"main": "src/index.js",
66
"bin": {
@@ -25,14 +25,15 @@
2525
"devDependencies": {
2626
"@launchpadlab/babel-preset": "^1.0.0",
2727
"@launchpadlab/eslint-config": "^2.1.0",
28-
"babel-core": "^6.26.0",
28+
"@babel/core": "^7.12.0",
2929
"babel-eslint": "^8.0.1",
30-
"babel-loader": "^7.1.4",
30+
"babel-loader": "^9.1.0",
3131
"eslint": "^4.10.0",
32-
"jest": "^21.2.1",
33-
"webpack": "^4.0.0"
32+
"jest": "^29.5.0",
33+
"webpack": "^5.0.0",
34+
"webpack-cli": "^5.0.1"
3435
},
3536
"peerDependencies": {
36-
"webpack": "^4.0.0"
37+
"webpack": "^4.0.0 || ^5.0.0"
3738
}
3839
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const fs = require('fs-extra')
66
const to = relPath => path.resolve(__dirname, relPath)
77

88
test('Generates dot index files', end => {
9-
109
const config = {
10+
mode: 'production',
1111
entry: to('./test-input'),
1212
output: {
1313
path: to('./test-output'),
@@ -28,9 +28,9 @@ test('Generates dot index files', end => {
2828

2929
webpack(config, (err, stats) => {
3030
expect(err).toEqual(null)
31-
const modules = stats.toJson().modules
31+
const modules = stats.toJson({ source: true }).modules
3232
expect(modules.length).toEqual(4)
33-
const indexFileContent = modules.pop().source
33+
const indexFileContent = modules.find((module) => module.name.includes('.index.js')).source
3434
expect(indexFileContent).toMatchSnapshot()
3535
end()
3636
})
@@ -40,6 +40,7 @@ test('Generates dot index files', end => {
4040
test('Accepts formatExports argument', end => {
4141
const toUpperCase = filename => filename.replace(/-/g, '').toUpperCase()
4242
const config = {
43+
mode: 'production',
4344
entry: to('./test-input'),
4445
output: {
4546
path: to('./test-output'),
@@ -60,9 +61,9 @@ test('Accepts formatExports argument', end => {
6061

6162
webpack(config, (err, stats) => {
6263
expect(err).toEqual(null)
63-
const modules = stats.toJson().modules
64+
const modules = stats.toJson({ source: true }).modules
6465
expect(modules.length).toEqual(4)
65-
const indexFileContent = modules.pop().source
66+
const indexFileContent = modules.find((module) => module.name.includes('.index.js')).source
6667
expect(indexFileContent).toMatchSnapshot()
6768
end()
6869
})

0 commit comments

Comments
 (0)