Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
707 views
in Technique[技术] by (71.8m points)

请问weex的entry.js出现Duplicate declaration "App"怎么解决?谢谢各位大佬

代码是参照的github上的一个weex阅读器,
照着entry.js打的时候打包运行出现了重复定义的错误,
求大佬看看是代码的问题,或者是版本更新的问题吗?

这个是编译后的其中一个web.js


import App from './App.vue'
import router from './router'
import store from './store'
// import { sync } from 'vuex-router-sync'
import * as filters from './filters'
import mixins from './mixins'

// sync(store, router)


Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.mixin(mixins)

new Vue(Vue.util.extend({ el: '#root', router, store }, App))

router.push('/')

const App = require('..\..\src\views\SearchResult.vue');
new Vue(Vue.util.extend({el: '#root'}, App));

调试报错如下:

error  in ./.temp/App.web.js
Module build failed: D:/Code/bookreadertwo/.temp/App.web.js: Duplicate declaration "App"

  26 | router.push('/')
  27 | 
> 28 | const App = require('..\src\App.vue');
     |       ^
  29 | new Vue(Vue.util.extend({el: '#root'}, App));
  30 | 


 @ multi (webpack)-dev-server/client?http://192.168.1.4:8081 ./.temp/App.web.js

entry.js的代码如下:

// import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { sync } from 'vuex-router-sync'
import * as filters from './filters'
import mixins from './mixins'

sync(store, router)

Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.mixin(mixins)

new Vue(Vue.util.extend({ el: '#root', router, store }, App))

router.push('/')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

不是

App.web.js

报的错吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...