forked from andywer/webpack-blocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (29 loc) · 705 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* Tslint webpack block.
*
* @see https://github.com/wbuchwalter/tslint-loader
*/
module.exports = tslint
/**
* @param {object} [options] See https://github.com/wbuchwalter/tslint-loader#usage
* @return {Function}
*/
function tslint (options = {}) {
return (context, util) => prevConfig => {
let nextConfig = util.addLoader(
Object.assign({
test: /\.(ts|tsx)$/,
use: [ 'tslint-loader' ],
enforce: 'pre'
}, context.match)
)(prevConfig)
nextConfig = util.addPlugin(
new context.webpack.LoaderOptionsPlugin({
options: {
tslint: options
}
})
)(nextConfig)
return nextConfig
}
}