@kispace-io/gs-lib 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/node-map-builder.ts +12 -3
- package/package.json +1 -1
package/lib/node-map-builder.ts
CHANGED
|
@@ -59,8 +59,8 @@ export async function createNodeResolvePlugin(projectRoot: string, gsLibPath: st
|
|
|
59
59
|
name: 'node-resolve',
|
|
60
60
|
setup(build: any) {
|
|
61
61
|
build.onResolve({ filter: /.*/ }, (args: any) => {
|
|
62
|
-
// Skip external URLs
|
|
63
|
-
if (args.path.startsWith('http://') || args.path.startsWith('https://')) {
|
|
62
|
+
// Skip external URLs and data URLs
|
|
63
|
+
if (args.path.startsWith('http://') || args.path.startsWith('https://') || args.path.startsWith('data:')) {
|
|
64
64
|
return
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -95,7 +95,16 @@ export async function createNodeResolvePlugin(projectRoot: string, gsLibPath: st
|
|
|
95
95
|
try {
|
|
96
96
|
const contents = await fs.readFile(args.path, 'utf-8')
|
|
97
97
|
const ext = path.extname(args.path)
|
|
98
|
-
|
|
98
|
+
let loader = 'js'
|
|
99
|
+
if (ext === '.ts') {
|
|
100
|
+
loader = 'ts'
|
|
101
|
+
} else if (ext === '.js') {
|
|
102
|
+
loader = 'js'
|
|
103
|
+
} else if (ext === '.json') {
|
|
104
|
+
loader = 'json'
|
|
105
|
+
} else if (ext === '.css') {
|
|
106
|
+
loader = 'css'
|
|
107
|
+
}
|
|
99
108
|
return { contents, loader }
|
|
100
109
|
} catch (error: any) {
|
|
101
110
|
throw new Error(`Failed to load ${args.path}: ${error.message}`)
|