Open rakibpaucse opened 3 years ago
import dynamic from "next/dynamic";
import { IEmojiPickerProps } from "emoji-picker-react";
const EmojiPickerNoSSRWrapper = dynamic<IEmojiPickerProps>(
() => import("emoji-picker-react"),
{
ssr: false,
loading: () => <p>Loading ...</p>,
}
);
this didn't worked
import dynamic from "next/dynamic"; import { IEmojiPickerProps } from "emoji-picker-react"; const EmojiPickerNoSSRWrapper = dynamic<IEmojiPickerProps>( () => import("emoji-picker-react"), { ssr: false, loading: () => <p>Loading ...</p>, } );
Another workaround for this is to use the vanilla dynamic importation like this:
let Picker;
if (typeof window !== 'undefined') {
import('emoji-picker-react').then(_module => {
Picker = _module.default;
});
}
I'm also getting this error now and again what could be the remedy for this issue
This works:
import dynamic from 'next/dynamic';
const Picker = dynamic(() => import('emoji-picker-react'), { ssr: false });
This works:
import dynamic from 'next/dynamic'; const Picker = dynamic(() => import('emoji-picker-react'), { ssr: false });
Yeah, It's also worked for me.
Any update on this? About giving patch or something?
This works:
import dynamic from 'next/dynamic'; const Picker = dynamic(() => import('emoji-picker-react'), { ssr: false });
Works for me!
Thanks
This works:
import dynamic from 'next/dynamic'; const Picker = dynamic(() => import('emoji-picker-react'), { ssr: false });
Works for me!
When i try to build, it still throws the same error ReferenceError: document is not defined
Another workaround for this is to use the vanilla dynamic importation like this:
let Picker; if (typeof window !== 'undefined') { import('emoji-picker-react').then(_module => { Picker = _module.default; }); }
This worked for me. We're not using Next, but seems like it should work for any SSR/Node environment.
I am getting
ReferenceError: document is not defined
error even when I import Picker this only. Dont you have SSR support in V3 ?