You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use npm to install tocbot, import it and init it.
I don't use the tool like webpack or gulp.
importtocbotfrom'tocbot'tocbot.init({// Where to render the table of contents.tocSelector: '.sidebar',// Where to grab the headings to build the table of contents.contentSelector: 'article',// Which headings to grab inside of the contentSelector element.headingSelector: 'h1, h2, h3',onClick: function(){if(shade.style.display==='block'){switchSidebar();}}});
This project is powered by hexo, and this error doesn't recurrent in another environment.
Maybe I wrongly use it.
Must it need the tool like webpack or gulp?
I believe hexo on its own doesn’t handle bundling frontend assets as it’s a tool to generate static sites.
So your options are: add webpack to hexo to support bundling / importing assets. Use something like gatsby which does use webpack, or just include the script on the page like so:
I use
npm
to installtocbot
, import it and init it.I don't use the tool like
webpack
orgulp
.But when I run, console display:
(node:41536) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token: name (tocbot)
The text was updated successfully, but these errors were encountered: