We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fa78ebb commit 401b65fCopy full SHA for 401b65f
apps/http-ws/import_replace_test.mjs
@@ -0,0 +1,23 @@
1
+import "./banana.mjs"
2
+
3
+const str = 'import {sack} from "sack.vfs" \n\
4
+import {local} from "./test.js" \n\
5
+import {another} from "/node_modules/something" \n\
6
+import * as foo from "../banana" \n\
7
+import * as foo from "banana/foo" \n\
8
+import THREE from "three"\n\
9
+import "foo"\n\
10
+import("foo" )\n\
11
+import( "foo" )\n\
12
+import ( "foo" )\n\
13
+import ("foo" )\n\
14
15
+';
16
17
18
+const str2 = str.replaceAll( /import([^\(]?\s+[^\(]?.*from\s+|)["']((?!\/|.\/|..\/)[^'"]*)["']/g, 'import$1"/$2"' )
19
+console.log( "out:", str2 );
20
21
22
+const str3 = str.replaceAll( /import([^\(]?\s+[^\(]?.*from\s+|)["']((?!\/|.\/|..\/)[^'"]*)["']/g, 'import$1"/$2?🔨=' + "(referer)" + '"' )
23
+console.log( "out:", str3 );
0 commit comments