SyntaxError: Importing binding name 'createClient' is not found
SyntaxError: Importing binding name 'createClient' is not found
我正在尝试初始化 Supabase
这是我的代码
import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js";
const supabase = createClient(link,key)
<script defer src="js/signup.js" type="module"></script>
这是下面的错误
SyntaxError: Importing binding name 'createClient' is not found.
该文件是 UMD 脚本,而不是本机 JavaScript 模块。根据 the documentation,原生 JavaScript ("ESM") 模块文件是 https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm
:
<script type="module">
import { createClient} from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm";
// Check we got the function:
console.log(typeof createClient); // "function"
</script>
如果你必须使用 UMD 版本,再次根据 the documentation,你会这样做:
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
<script>
const { createClient } = supabase;
// Check we got the function:
console.log(typeof createClient); // "function"
</script>
我正在尝试初始化 Supabase
这是我的代码
import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js";
const supabase = createClient(link,key)
<script defer src="js/signup.js" type="module"></script>
这是下面的错误
SyntaxError: Importing binding name 'createClient' is not found.
该文件是 UMD 脚本,而不是本机 JavaScript 模块。根据 the documentation,原生 JavaScript ("ESM") 模块文件是 https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm
:
<script type="module">
import { createClient} from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm";
// Check we got the function:
console.log(typeof createClient); // "function"
</script>
如果你必须使用 UMD 版本,再次根据 the documentation,你会这样做:
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
<script>
const { createClient } = supabase;
// Check we got the function:
console.log(typeof createClient); // "function"
</script>