研发效能 vue-cli2.x 构建的项目无法使用 vue-testcase-minder-editor 组件

测试游记 · 2022年03月22日 · 最后由 测试游记 回复于 2022年04月07日 · 3862 次阅读

想用http://testerhome.com/topics/31539来把旧项目的思维导图替换了,结果死活运行不起来

有大佬可以帮忙看看么

创建项目

vue init webpack demo1

? Project name demo
? Project description A Vue.js project
? Author xx <490336534@qq.com>
? Vue build runtime
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm

安装组件

cd demo1

npm install vuex@3.6.0 --save
npm --registry=https://registry.npm.taobao.org install vue-testcase-minder-editor

修改 main.js

import Vue from 'vue'
import App from './App'
import router from './router'
import 'vue-testcase-minder-editor/lib/VueTestcaseMinderEditor.css'
import VueTestcaseMinderEditor from 'vue-testcase-minder-editor'

Vue.use(VueTestcaseMinderEditor)
Vue.config.productionTip = false
Vue.use(Vuex)
const store = new Vuex.Store({
  modules: {
    caseEditorStore: VueTestcaseMinderEditor.caseEditorStore
  }
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})

运行

(base) zhongxin:demo1 zhongxin$ npm run dev

> demo1@1.0.0 dev
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

 13% building modules 30/36 modules 6 active ...xin/VueProject/vue2/demo1/src/App.vue{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }.
 94% asset optimization                                                              

 ERROR  Failed to compile with 2 errors                                                                                                                                               下午3:50:31

 error  in ./node_modules/vue-testcase-minder-editor/lib/VueTestcaseMinderEditor.css

Module build failed: BrowserslistError: Unknown browser query `dead`
    at /Users/zhongxin/VueProject/vue2/demo1/node_modules/browserslist/index.js:164:11
    at Array.reduce (<anonymous>)
    at resolve (/Users/zhongxin/VueProject/vue2/demo1/node_modules/browserslist/index.js:132:18)
    at browserslist (/Users/zhongxin/VueProject/vue2/demo1/node_modules/browserslist/index.js:224:16)
    at Browsers.parse (/Users/zhongxin/VueProject/vue2/demo1/node_modules/autoprefixer/lib/browsers.js:61:16)
    at new Browsers (/Users/zhongxin/VueProject/vue2/demo1/node_modules/autoprefixer/lib/browsers.js:52:30)
    at loadPrefixes (/Users/zhongxin/VueProject/vue2/demo1/node_modules/autoprefixer/lib/autoprefixer.js:70:24)
    at plugin (/Users/zhongxin/VueProject/vue2/demo1/node_modules/autoprefixer/lib/autoprefixer.js:81:24)
    at LazyResult.run (/Users/zhongxin/VueProject/vue2/demo1/node_modules/postcss/lib/lazy-result.js:277:20)
    at LazyResult.asyncTick (/Users/zhongxin/VueProject/vue2/demo1/node_modules/postcss/lib/lazy-result.js:192:32)
    at LazyResult.asyncTick (/Users/zhongxin/VueProject/vue2/demo1/node_modules/postcss/lib/lazy-result.js:204:22)
    at /Users/zhongxin/VueProject/vue2/demo1/node_modules/postcss/lib/lazy-result.js:197:27

 @ ./node_modules/vue-testcase-minder-editor/lib/VueTestcaseMinderEditor.css 4:14-136 13:3-17:5 14:22-144
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

 error  in ./node_modules/vue-testcase-minder-editor/lib/VueTestcaseMinderEditor.umd.min.js

Module parse failed: Unexpected token (95:251947)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)

 @ ./src/main.js 5:0-65
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js



共收到 2 条回复 时间 点赞

你的工程代码方便分享下不?之前也有同学反馈过,但我这重现不了,不好处理。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册