File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
- import webpack from 'webpack'
2
1
import type { Compiler } from 'webpack'
3
2
4
3
declare class VueLoaderPlugin {
5
4
static NS : string
6
5
apply ( compiler : Compiler ) : void
7
6
}
8
7
9
- let Plugin : typeof VueLoaderPlugin
8
+ const NS = 'vue-loader'
10
9
11
- if ( webpack . version && webpack . version [ 0 ] > '4' ) {
12
- // webpack5 and upper
13
- Plugin = require ( './pluginWebpack5' ) . default
14
- } else {
15
- // webpack4 and lower
16
- Plugin = require ( './pluginWebpack4' ) . default
10
+ class Plugin {
11
+ static NS = NS
12
+ apply ( compiler : Compiler ) {
13
+ let Ctor : typeof VueLoaderPlugin
14
+ if ( compiler . webpack ?. version && compiler . webpack . version [ 0 ] > '4' ) {
15
+ // webpack5 and upper
16
+ Ctor = require ( './pluginWebpack5' ) . default
17
+ } else {
18
+ // webpack4 and lower
19
+ Ctor = require ( './pluginWebpack4' ) . default
20
+ }
21
+ new Ctor ( ) . apply ( compiler )
22
+ }
17
23
}
18
24
19
25
export default Plugin
You can’t perform that action at this time.
0 commit comments