@@ -5,6 +5,8 @@ import {NodeVisitor} from "./node-visitor";
5
5
6
6
const sha256 = require ( 'crypto-js/sha256' ) ;
7
7
const hex = require ( 'crypto-js/enc-hex' ) ;
8
+ const process = require ( 'process' ) ;
9
+ const slash = require ( 'slash' ) ;
8
10
9
11
const validateOptions = require ( 'schema-utils' ) ;
10
12
@@ -48,8 +50,14 @@ export default function (this: loader.LoaderContext, source: string) {
48
50
let environment : TwingEnvironment = require ( environmentModulePath ) ;
49
51
50
52
if ( renderContext === undefined ) {
53
+ let runtimePath = require . resolve ( './runtime' ) ;
54
+ if ( process . platform === 'win32' ) {
55
+ environmentModulePath = slash ( environmentModulePath ) ;
56
+ runtimePath = slash ( runtimePath ) ;
57
+ }
58
+
51
59
let parts : string [ ] = [
52
- `const {cache, loader, getEnvironment} = require('${ require . resolve ( './runtime' ) } ');` ,
60
+ `const {cache, loader, getEnvironment} = require('${ runtimePath } ');` ,
53
61
`const env = getEnvironment(require('${ environmentModulePath } '));`
54
62
] ;
55
63
@@ -89,6 +97,9 @@ return module.exports;})());
89
97
parts . push ( `loader.addTemplateKey('${ className } ', '${ className } ');` ) ;
90
98
91
99
for ( let foundTemplateName of nodeVisitor . foundTemplateNames ) {
100
+ if ( process . platform === 'win32' ) {
101
+ foundTemplateName = slash ( foundTemplateName ) ;
102
+ }
92
103
parts . push ( `require('${ foundTemplateName } ');` ) ;
93
104
}
94
105
0 commit comments