This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ describe("css2jsonLoader", () => {
38
38
39
39
const loaderContext = {
40
40
callback : ( error , source : string , map ) => {
41
- expect ( source ) . toContain ( `global.registerModule("custom.css", () => require("custom.css"))` ) ;
41
+ expect ( source ) . toContain ( `global.registerModule("./ custom.css", () => require("./ custom.css"))` ) ;
42
42
expect ( source ) . toContain ( `{"type":"declaration","property":"background-color","value":"#7f9"}` ) ;
43
43
44
44
done ( ) ;
@@ -52,7 +52,7 @@ describe("css2jsonLoader", () => {
52
52
it ( "inlines css2json loader in imports if option is provided" , ( done ) => {
53
53
const loaderContext = {
54
54
callback : ( error , source : string , map ) => {
55
- expect ( source ) . toContain ( `global.registerModule("custom.css", () => require("!nativescript-dev-webpack/css2json-loader?useForImports!custom.css"))` ) ;
55
+ expect ( source ) . toContain ( `global.registerModule("./ custom.css", () => require("!nativescript-dev-webpack/css2json-loader?useForImports!./ custom.css"))` ) ;
56
56
expect ( source ) . toContain ( `{"type":"declaration","property":"background-color","value":"#7f9"}` ) ;
57
57
58
58
done ( ) ;
Original file line number Diff line number Diff line change 1
1
import { parse , Import , Stylesheet } from "css" ;
2
2
import { loader } from "webpack" ;
3
- import { getOptions } from "loader-utils" ;
3
+ import { getOptions , urlToRequest } from "loader-utils" ;
4
4
5
5
const betweenQuotesPattern = / ( ' | " ) ( .* ?) \1/ ;
6
6
const unpackUrlPattern = / u r l \( ( [ ^ \) ] + ) \) / ;
@@ -53,7 +53,7 @@ function extractUrlFromRule(importRule: Import): string {
53
53
function createRequireUri ( uri ) : { uri : string , requireURI : string } {
54
54
return {
55
55
uri : uri ,
56
- requireURI : uri [ 0 ] === "~" && uri [ 1 ] !== "/" ? uri . substr ( 1 ) : uri
56
+ requireURI : urlToRequest ( uri )
57
57
} ;
58
58
}
59
59
You can’t perform that action at this time.
0 commit comments