File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1
1
var DtsCreator = require ( 'typed-css-modules' ) ;
2
-
3
- var creator = new DtsCreator ( ) ;
2
+ var loaderUtils = require ( 'loader-utils' ) ;
3
+ var objectAssign = require ( 'object-assign' ) ;
4
4
5
5
module . exports = function ( source , map ) {
6
6
this . cacheable && this . cacheable ( ) ;
7
7
var callback = this . async ( ) ;
8
-
8
+
9
+ // Pass on query parameters as an options object to the DtsCreator. This lets
10
+ // you change the default options of the DtsCreator and e.g. use a different
11
+ // output folder.
12
+ var queryOptions = loaderUtils . parseQuery ( this . query ) ;
13
+ var options ;
14
+ if ( queryOptions ) {
15
+ options = objectAssign ( { } , queryOptions ) ;
16
+ }
17
+
18
+ var creator = new DtsCreator ( options ) ;
19
+
9
20
// creator.create(..., source) tells the module to operate on the
10
21
// source variable. Check API for more details.
11
22
creator . create ( this . resourcePath , source ) . then ( content => {
Original file line number Diff line number Diff line change 22
22
"license" : " MIT" ,
23
23
"bugs" : {
24
24
"url" : " https://github.com/olegstepura/typed-css-modules-loader/issues"
25
+ },
26
+ "dependencies" : {
27
+ "loader-utils" : " ^0.2.15" ,
28
+ "object-assign" : " ^4.1.0"
25
29
}
26
30
}
You can’t perform that action at this time.
0 commit comments