-
Notifications
You must be signed in to change notification settings - Fork 14
Cannot read properties of null (reading 'content') #21
Description
My version of docusaurus is 3.6.3,
After configuring according to the tutorial, an error is reported when running.
Here is my docusaurus.config.js configuration.
`
import {themes as prismThemes} from 'prism-react-renderer';
const config = {
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.js',
},
theme: {
customCss: './src/css/custom.css',
},
}),
],
],
plugins: [
'plugin-image-zoom'
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
imageZoom: {
// CSS selector to apply the plugin to, defaults to '.markdown img'
selector: '.markdown img',
// Optional medium-zoom options
// see: https://www.npmjs.com/package/medium-zoom#options
options: {
margin: 24,
background: '#BADA55',
scrollOffset: 0,
container: '#zoom-container',
template: '#zoom-template',
},
},
};
export default config;`
My markdown document is as follows: it is in md format, not mdx format. In fact, I have tried both formats and still get the same error.

When running the project locally, it can be successfully compiled and run. When I click on the picture, an error will be reported. The complete error is as follows
ERROR
Cannot read properties of null (reading 'content')
TypeError: Cannot read properties of null (reading 'content')
at eval (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:391:46)
at new Promise ()
at open (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:346:12)
at toggle (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:537:12)
at HTMLDocument._handleClick (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:135:5)