We have a strange issue using this lib, which is only reproducible in our production builds:
TypeError: Cannot read properties of undefined (reading 'list')
at react-anchorme.esm.js:1:1275
at react-anchorme.esm.js:1:1550
at Object.useMemo (react-dom.production.min.js:184:189)
at Er.useMemo (react.production.min.js:25:208)
at react-anchorme.esm.js:1:1530
at eK (react-dom.production.min.js:167:137)
at s$ (react-dom.production.min.js:197:258)
at Vge (react-dom.production.min.js:195:204)
at dre (react-dom.production.min.js:194:176)
at lbe (react-dom.production.min.js:297:71)
o$ @ react-dom.production.min.js:189
which I can pinpoint to line 16 in AnchorMe.tsx:
import React, { useCallback, useMemo } from 'react'
import anchorme from 'anchorme'
import { AnchorProps, LinkComponent } from './types'
import { Link } from './Link'
type Props = {
children: string
linkComponent?: LinkComponent
} & AnchorProps
const Anchorme = ({ children, ...rest }: Props) => {
const text = children
const parse = useCallback(() => {
const matches = anchorme.list(text) // <- This right here
if (matches.length === 0) return text
...
What gives? It's as if the anchorme package isn't bundled for production?
We have a strange issue using this lib, which is only reproducible in our production builds:
which I can pinpoint to line 16 in
AnchorMe.tsx
:What gives? It's as if the
anchorme
package isn't bundled for production?Environment: