mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-23 19:48:54 +02:00
fix(v2): fix plugin-ideal-image breaking website (exports not defined) (#2074)
* fix(v2): fix plugin-ideal-image breaking website (exports not defined) * nits * add npm ignore * lint
This commit is contained in:
parent
464d8e529a
commit
8a948102c3
9 changed files with 30 additions and 43 deletions
|
@ -10,7 +10,7 @@ import {Configuration} from 'webpack';
|
|||
|
||||
import path from 'path';
|
||||
|
||||
export = function(_context: LoadContext, options: PluginOptions) {
|
||||
export default function(_context: LoadContext, options: PluginOptions) {
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
return {
|
||||
name: 'docusaurus-plugin-ideal-image',
|
||||
|
@ -47,4 +47,4 @@ export = function(_context: LoadContext, options: PluginOptions) {
|
|||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {ImageProps} from '../types';
|
||||
import IdealImage from '@endiliey/react-ideal-image';
|
||||
|
||||
const Image: React.FC<ImageProps> = props => {
|
||||
function Image(props) {
|
||||
const {alt, className, img} = props;
|
||||
return (
|
||||
<IdealImage
|
||||
|
@ -20,12 +18,12 @@ const Image: React.FC<ImageProps> = props => {
|
|||
width={img.src.width || 100}
|
||||
placeholder={{lqip: img.preSrc}}
|
||||
src={img.src.src}
|
||||
srcSet={img.src.images.map((image: any) => ({
|
||||
srcSet={img.src.images.map(image => ({
|
||||
...image,
|
||||
src: image.path,
|
||||
}))}
|
||||
/>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default Image;
|
|
@ -35,7 +35,3 @@ export interface PluginOptions {
|
|||
*/
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
export interface ImageProps extends React.ImgHTMLAttributes<{}> {
|
||||
img: any;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue