别人说把用BroadcastChannel的文件从vue改为we就可以了。我改了以后就不行了。大家帮我看哪里配置错了。
var path = require('path') var webpack = require('webpack') require('weex-loader'); var bannerPlugin = new webpack.BannerPlugin( '// { "framework": "Vue" }\n', { raw: true } ) function getBaseConfig () { return { entry: { 'index': path.resolve('src', 'entry.js') }, output: { path: 'dist', }, module: { loaders: [ { test: /\.js$/, loader: 'babel', exclude: /node_modules/ }, { test: /\.vue(\?[^?]+)?$/, loaders: [] },{ test: /\.we(\?[^?]+)?$/ , loaders: ['weex-loader'] }] }, plugins: [bannerPlugin] } } var webConfig = getBaseConfig() webConfig.output.filename = '[name].web.js' webConfig.module.loaders[1].loaders.push('vue') var weexConfig = getBaseConfig() weexConfig.output.filename = '[name].weex.js' weexConfig.module.loaders[1].loaders.push('weex')
// import Vue from 'vue' import Router from 'vue-router' import StoriesView from './views/StoriesView.vue' import ArticleView from './views/ArticleView.vue' import CommentView from './views/CommentView.vue' import UserView from './views/UserView.vue' import DemoView from './WeexDemo/total.vue' import first from './WeexDemo/first.vue' import second from './WeexDemo/second.vue' import three from './WeexDemo/three.vue' import four from './WeexDemo/four.vue' Vue.use(Router) // Story view factory function createStoriesView (type) { return { name: `${type}-stories-view`, render (createElement) { return createElement(StoriesView, { props: { type }}) } } } export default new Router({ // mode: 'abstract', routes: [ { path: '/top', component: createStoriesView('top') }, { path: '/new', component: createStoriesView('new') }, { path: '/show', component: createStoriesView('show') }, { path: '/ask', component: createStoriesView('ask') }, { path: '/job', component: createStoriesView('job') }, { path: '/demo', component: DemoView}, { path: '/first', component:first}, { path: '/second', component:second}, { path: '/three', component:three}, { path: '/four', component:four}, { path: '/article/:url(.*)?', component: ArticleView }, { path: '/item/:id(\\d+)', component: CommentView }, { path: '/user/:id', component: UserView }, { path: '/', redirect: '/top' } ] })
直接把total.vue改为total.we就不行了。求大家帮我看看。
没见到代码里有 BroadcastChannel
啊。
另外,.we 和 .vue 是两种语法,内部用的框架不一样,打包方式也不一样的,直接改后缀名肯定是不行的。