Skip to content

Commit

Permalink
fix: avoid ReferenceError in browser
Browse files Browse the repository at this point in the history
`process && process.emitWarning` will cause `ReferenceError: process is not defined` in browser
  • Loading branch information
OpportunityLiu authored Jul 23, 2021
1 parent 1f44060 commit 101d981
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function legacy (slug, opts, state, idx) {
if (!emittedWarning) {
const warningText = 'Using deprecated markdown-it-anchor permalink option, see https://github.com/valeriangalliat/markdown-it-anchor#todo-anchor-or-file'

if (process && process.emitWarning) {
if (typeof process === 'object' && process && process.emitWarning) {
process.emitWarning(warningText)
} else {
console.warn(warningText)
Expand Down

0 comments on commit 101d981

Please sign in to comment.