-
Notifications
You must be signed in to change notification settings - Fork 0
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
Chore: Support Webpack 5 #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'), | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
expect(modules.length).toEqual(4) | ||
const indexFileContent = modules.pop().source | ||
const indexFileContent = modules.find((module) => module.name.includes('.index.js')).source | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webpack 5 returns the .index file as the first file. Instead of switching this to |
||
expect(indexFileContent).toMatchSnapshot() | ||
end() | ||
}) | ||
|
@@ -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'), | ||
|
@@ -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() | ||
}) | ||
|
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.
Webpack recommends always adding
mode
https://webpack.js.org/migrate/5/#make-sure-to-use-mode