This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ describe("css2jsonLoader", () => {
3838
3939 const loaderContext = {
4040 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"))` ) ;
4242 expect ( source ) . toContain ( `{"type":"declaration","property":"background-color","value":"#7f9"}` ) ;
4343
4444 done ( ) ;
@@ -52,7 +52,7 @@ describe("css2jsonLoader", () => {
5252 it ( "inlines css2json loader in imports if option is provided" , ( done ) => {
5353 const loaderContext = {
5454 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"))` ) ;
5656 expect ( source ) . toContain ( `{"type":"declaration","property":"background-color","value":"#7f9"}` ) ;
5757
5858 done ( ) ;
Original file line number Diff line number Diff line change 11import { parse , Import , Stylesheet } from "css" ;
22import { loader } from "webpack" ;
3- import { getOptions } from "loader-utils" ;
3+ import { getOptions , urlToRequest } from "loader-utils" ;
44
55const betweenQuotesPattern = / ( ' | " ) ( .* ?) \1/ ;
66const unpackUrlPattern = / u r l \( ( [ ^ \) ] + ) \) / ;
@@ -53,7 +53,7 @@ function extractUrlFromRule(importRule: Import): string {
5353function createRequireUri ( uri ) : { uri : string , requireURI : string } {
5454 return {
5555 uri : uri ,
56- requireURI : uri [ 0 ] === "~" && uri [ 1 ] !== "/" ? uri . substr ( 1 ) : uri
56+ requireURI : urlToRequest ( uri )
5757 } ;
5858}
5959
You can’t perform that action at this time.
0 commit comments