在我的一个组件中,我需要以下两个:
import Image from 'next/image';
(来自NextJS)
Image()
(来自TypeScript)
这两者是相互矛盾的。
是否可以给next/image
一个不同的名字?我试着
import Image as image from 'next/image';
和
import {Image as image} from 'next/image';
但他们没有工作。
有两种方法:
// CommonJS style
const { default: NextImage } = require("next/image");
// ES module style
import NextImage from "next/image";
// alternatively
import { default as NextImage } from "next/image";