Skip to content

Commit fbfd616

Browse files
huy-nguyenKent C. Dodds
authored and
Kent C. Dodds
committed
feat: Allow performance.hints in webpack config (#150)
* feat: Allow performance.hints in webpack config Webpack 2.1.0-beta.28 adds `performance.hints` (which take boolean values) as a way to enable/disable performance warnings. (The first performance warning is about bundle size.) * fix: Fix name of an import The test file for the `performance` property should import the test utils module using `utils` in lowercase but instead imported `Utils` in uppercase. This worked fine on my machine because my filesystem is case-insensitive but fails in Travis because its filesystem is case-sensitive.
1 parent fd3b40d commit fbfd616

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import resolveSchemaFn from './properties/resolve'
1111
import outputSchema from './properties/output'
1212
import watchOptionsSchema from './properties/watchOptions'
1313
import devServerSchema from './properties/devServer'
14+
import performanceSchema from './properties/performance'
1415
import { looksLikeAbsolutePath } from './types'
1516
import _merge from 'lodash/merge'
1617
import sh from 'shelljs'
@@ -55,6 +56,7 @@ function makeSchema(schemaOptions, schemaExtension) {
5556
})),
5657
watch: Joi.boolean(),
5758
watchOptions: watchOptionsSchema,
59+
performance: performanceSchema,
5860
stats: Joi.any(), // TODO
5961
target: Joi.any(), // TODO
6062

src/properties/performance/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Joi from 'joi'
2+
3+
export default Joi.object({
4+
hints: Joi.boolean(),
5+
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import schema from './index'
2+
import { allValid } from '../../../test/utils'
3+
4+
const validPerformanceConfigs = [
5+
{ input: { hints: true } },
6+
{ input: { hints: false } },
7+
]
8+
9+
describe('performance', () => {
10+
allValid(validPerformanceConfigs, schema)
11+
})

0 commit comments

Comments
 (0)