File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ var path = require('path');
6
6
var webpack = require ( 'webpack' ) ;
7
7
var ForkTsCheckerWebpackPlugin = require ( '../../lib/index' ) ;
8
8
9
+ var webpackMajorVersion = require ( './webpackVersion' ) ( ) ;
10
+
9
11
describe ( '[INTEGRATION] index' , function ( ) {
10
12
this . timeout ( 30000 ) ;
11
13
var plugin ;
@@ -18,7 +20,7 @@ describe('[INTEGRATION] index', function () {
18
20
: { transpileOnly : true , silent : true } ;
19
21
20
22
return webpack ( {
21
- mode : 'development' ,
23
+ ... ( webpackMajorVersion >= 4 ? { mode : 'development' } : { } ) ,
22
24
context : path . resolve ( __dirname , './project' ) ,
23
25
entry : './src/index.ts' ,
24
26
output : {
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ var process = require('process');
8
8
var ForkTsCheckerWebpackPlugin = require ( '../../lib/index' ) ;
9
9
var IncrementalChecker = require ( '../../lib/IncrementalChecker' ) ;
10
10
11
+ var webpackMajorVersion = require ( './webpackVersion' ) ( ) ;
12
+
11
13
describe ( '[INTEGRATION] vue' , function ( ) {
12
14
this . timeout ( 30000 ) ;
13
15
process . setMaxListeners ( 20 ) ;
@@ -20,7 +22,7 @@ describe('[INTEGRATION] vue', function () {
20
22
plugin = new ForkTsCheckerWebpackPlugin ( Object . assign ( { } , options , { silent : true } ) ) ;
21
23
22
24
compiler = webpack ( {
23
- mode : 'development' ,
25
+ ... ( webpackMajorVersion >= 4 ? { mode : 'development' } : { } ) ,
24
26
context : path . resolve ( __dirname , './vue' ) ,
25
27
entry : './src/index.ts' ,
26
28
output : {
Original file line number Diff line number Diff line change
1
+ function getWebpackMajorVersion ( ) {
2
+ // Determine major webpack version from package.json
3
+ var packageJson = require ( '../../package.json' ) ;
4
+ var webpackVersion = packageJson . devDependencies . webpack . replace (
5
+ / [ ^ 0 - 9 . ] / g,
6
+ ''
7
+ ) ;
8
+ var webpackMajorVersion = parseInt ( webpackVersion . split ( '.' ) [ 0 ] , 10 ) ;
9
+ return webpackMajorVersion ;
10
+ }
11
+
12
+ module . exports = getWebpackMajorVersion ;
You can’t perform that action at this time.
0 commit comments