Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2916239
index.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
652 B
Referenced Files
None
Subscribers
None
index.ts
View Options
import
{
nanoid
}
from
'nanoid'
;
import
{
join
}
from
'node:path'
;
import
*
as
esbuild
from
'esbuild'
;
const
args
=
[
`id=
${
nanoid
()
}
`
];
const
replacements
:
Record
<
string
,
string
>
=
{};
for
(
const
arg
of
args
)
{
const
pivot
=
arg
.
indexOf
(
'='
);
if
(
pivot
===
-
1
)
continue
;
const
key
=
arg
.
slice
(
0
,
pivot
);
const
value
=
arg
.
slice
(
pivot
+
1
);
replacements
[
`import.meta.env.
${
key
}
`
]
=
JSON
.
stringify
(
value
);
}
const
result
=
await
esbuild
.
build
({
entryPoints
:
[
join
(
import
.
meta
.
dirname
,
'app.jsx'
)],
bundle
:
true
,
write
:
false
,
define
:
replacements
});
if
(
result
.
outputFiles
?
.
length
)
{
console
.
log
(
result
.
outputFiles
[
0
].
text
);
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Thu, Mar 26, 4:44 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
511934
Default Alt Text
index.ts (652 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment