Skip to content

Commit

Permalink
Chore: Support Webpack 5 (#15)
Browse files Browse the repository at this point in the history
* Update version and peer dependencies

* Update dev dependencies and tests

* Add mode

* Remove unnecessary comma

* Update noder version
  • Loading branch information
chawes13 authored Mar 10, 2023
1 parent 49673ea commit 983e08f
Show file tree
Hide file tree
Showing 4 changed files with 2,307 additions and 3,249 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '8'
- '16'
notifications:
email: false
deploy:
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dot-index-webpack-plugin",
"version": "5.2.0",
"version": "5.3.0",
"description": "",
"main": "src/index.js",
"bin": {
Expand All @@ -25,14 +25,15 @@
"devDependencies": {
"@launchpadlab/babel-preset": "^1.0.0",
"@launchpadlab/eslint-config": "^2.1.0",
"babel-core": "^6.26.0",
"@babel/core": "^7.12.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.4",
"babel-loader": "^9.1.0",
"eslint": "^4.10.0",
"jest": "^21.2.1",
"webpack": "^4.0.0"
"jest": "^29.5.0",
"webpack": "^5.0.0",
"webpack-cli": "^5.0.1"
},
"peerDependencies": {
"webpack": "^4.0.0"
"webpack": "^4.0.0 || ^5.0.0"
}
}
11 changes: 6 additions & 5 deletions test/dot-index-plugin/dot-index-plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const fs = require('fs-extra')
const to = relPath => path.resolve(__dirname, relPath)

test('Generates dot index files', end => {

const config = {
mode: 'production',
entry: to('./test-input'),
output: {
path: to('./test-output'),
Expand All @@ -28,9 +28,9 @@ test('Generates dot index files', end => {

webpack(config, (err, stats) => {
expect(err).toEqual(null)
const modules = stats.toJson().modules
const modules = stats.toJson({ source: true }).modules
expect(modules.length).toEqual(4)
const indexFileContent = modules.pop().source
const indexFileContent = modules.find((module) => module.name.includes('.index.js')).source
expect(indexFileContent).toMatchSnapshot()
end()
})
Expand All @@ -40,6 +40,7 @@ test('Generates dot index files', end => {
test('Accepts formatExports argument', end => {
const toUpperCase = filename => filename.replace(/-/g, '').toUpperCase()
const config = {
mode: 'production',
entry: to('./test-input'),
output: {
path: to('./test-output'),
Expand All @@ -60,9 +61,9 @@ test('Accepts formatExports argument', end => {

webpack(config, (err, stats) => {
expect(err).toEqual(null)
const modules = stats.toJson().modules
const modules = stats.toJson({ source: true }).modules
expect(modules.length).toEqual(4)
const indexFileContent = modules.pop().source
const indexFileContent = modules.find((module) => module.name.includes('.index.js')).source
expect(indexFileContent).toMatchSnapshot()
end()
})
Expand Down
Loading

0 comments on commit 983e08f

Please sign in to comment.