Issue with Supabase Client and Dynamic Imports
Certainly! When posting on a developer forum, it's helpful to provide a clear and concise question. Here's a suggestion for your forum post:
Title: Issue with Supabase Client and Dynamic Imports
I'm encountering an issue with my Next.js project where I'm using the Supabase client with dynamic imports. The error message I'm receiving is as follows:
Import trace for requested module:
external "https://esm.sh/@supabase/supabase-js@2"
./config/supabaseClient.js
./app/waitlist/page.jsx
⨯ external "https://esm.sh/@supabase/supabase-js@2"
The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
Import trace for requested module:
external "https://esm.sh/@supabase/supabase-js@2"
./config/supabaseClient.js
./app/waitlist/page.jsx
Here is my supabaseClient.js file:
Copy code
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2';
const supabaseUrl = process.env.NEXT_APP_SUPABASE_URL;
const supabaseKey = process.env.NEXT_APP_ANON_KEY;
const supabase = createClient(supabaseKey, supabaseUrl);
export { supabase };
And here's a snippet from my page.jsx file:
import supabase from "@/config/supabaseClient";
// ...
I've tried adjusting the imports and making sure the dynamic import syntax is supported, but I'm still encountering this issue. Any insights or suggestions on how to resolve this would be greatly appreciated!
Title: Issue with Supabase Client and Dynamic Imports
I'm encountering an issue with my Next.js project where I'm using the Supabase client with dynamic imports. The error message I'm receiving is as follows:
Import trace for requested module:
external "https://esm.sh/@supabase/supabase-js@2"
./config/supabaseClient.js
./app/waitlist/page.jsx
⨯ external "https://esm.sh/@supabase/supabase-js@2"
The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
Import trace for requested module:
external "https://esm.sh/@supabase/supabase-js@2"
./config/supabaseClient.js
./app/waitlist/page.jsx
Here is my supabaseClient.js file:
Copy code
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2';
const supabaseUrl = process.env.NEXT_APP_SUPABASE_URL;
const supabaseKey = process.env.NEXT_APP_ANON_KEY;
const supabase = createClient(supabaseKey, supabaseUrl);
export { supabase };
And here's a snippet from my page.jsx file:
import supabase from "@/config/supabaseClient";
// ...
I've tried adjusting the imports and making sure the dynamic import syntax is supported, but I'm still encountering this issue. Any insights or suggestions on how to resolve this would be greatly appreciated!