Skip to content

Commit

Permalink
fix tocbot docs page
Browse files Browse the repository at this point in the history
  • Loading branch information
tscanlin committed May 7, 2024
1 parent cdc2378 commit 3d1d4ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const express = require('express')
const next = require('next')
const config = require('./next.config.js')
import express from 'express'
import next from 'next'
import config from './next.config.mjs'

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
Expand Down
5 changes: 1 addition & 4 deletions src/components/Template/Tocbot/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import * as tocbot from '../../../js/index-esm.js'

const TOCBOT_OPTIONS = {
tocSelector: '.js-toc',
Expand All @@ -14,10 +15,6 @@ const TOCBOT_OPTIONS = {
// skipRendering: true,
}

// Only require tocbot if in browser.
const tocbot =
typeof window !== 'undefined' ? require('../../../js/index-dist.js') : null

export default class Tocbot extends React.Component {
componentDidMount () {
if (tocbot) {
Expand Down

0 comments on commit 3d1d4ed

Please sign in to comment.