yaohaixiao / outline.js

outline.js - 自动生成文章导读(Table of Contents)导航的 JavaScript 工具。会自动分析文章中的标题( h1~h6 )标签,并生成文章段落层次结构的导读导航菜单。
https://yaohaixiao.github.io/outline.js/
MIT License
129 stars 16 forks source link

Vue2中这个报错怎么解决 #51

Closed valklyrss closed 4 months ago

valklyrss commented 4 months ago

ERROR Failed to compile with 1 error 17:02:39

error in ./node_modules/@yaohaixiao/outline.js/outline.js

Module parse failed: Unexpected token (347:14) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | } | }

if (tools?.length > 0) {

| buttons.push(...tools) | }

@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/blog/detail.vue?vue&type=script&lang=js 12:38-79 @ ./src/views/blog/detail.vue?vue&type=script&lang=js @ ./src/views/blog/detail.vue @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://192.168.8.16:81&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

yaohaixiao commented 4 months ago

你是直接引用的我的 ES6 模块吗?如果是,添加以下这个插件:@babel/plugin-transform-optional-chaining

` /**

yaohaixiao commented 4 months ago

应该可以确定是你的项目没有配置 配置“可选链操作符”(babel插件) 的解析插件的问题了