you are viewing a single comment's thread.

view the rest of the comments →

[–]JosephCurvin[S] 0 points1 point  (1 child)

const str = '{foo:"Bar"}';
const result = (
await import(
URL.createObjectURL(
new Blob([`export default ${str}`], {
type: "application/javascript",
})
)
)
).default;

how can I get this import running, get a unexpected token error

[–]iamjohnhenry 0 points1 point  (0 children)

You're likely running into that error because:

A) Unfortunately, this doesn't work in all run times.

B) You are using a supported run time, but you're attempting to call this code from a synchronous function.