webpack - Vue 2 + VueRouter 2 + Laravel 5.3 - Webpack(运行时 x 独立构建问题)

标签 webpack laravel-5.3 vuejs2

我在尝试将 Vuejs 2 + Vue Router 2 + Laravel 5.3 与 webpack 一起使用时遇到错误!

这是我的代码:

我的index.html

<div id="app">
        <router-view></router-view>
    </div>

我的app.js

import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import Map from './map'

Vue.use(VueRouter);

const router = new VueRouter({
    routes: Map
});

new Vue({
    router,
    render: h => {
        return h(App)
    }
}).$mount('#app');

我的App.vue

<template>
    <router-view></router-view>
</template>

<script>
    export default {
        name: 'App',
    }
</script>

这样就会出现以下错误:

You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

如果我将 Vue 导入更改为: 从“vue”导入 Vue从“vue/dist/vue.js”导入 Vue 效果很好!

有人知道怎么解决吗?

最佳答案

伙计们,我认为这与 laravel-elixie-vue 包有关!

我与 Anderson 合作,我们安装了一个新的 laravel 版本,它附带了新的包 laravel-elixir-vue-2 并解决了问题!

当我们更新软件包时,Vedovelli 和 Vinicius 的评论都可以正常工作!

谢谢

关于webpack - Vue 2 + VueRouter 2 + Laravel 5.3 - Webpack(运行时 x 独立构建问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39876064/

相关文章:

laravel - 当变量为空时,Laravel 5.3验证失败

javascript - 如何在 Vue 类组件中定义过滤器?

javascript - 在 AVA 测试中使用 webpack 别名

reactjs - TypeScript + VSCode 中的自定义模块分辨率

php - Laravel 集合 mapWithKeys

php - SQLSTATE[HY000] [1045] 用户 'root' @'114.xxx.xxx.xxx' 的访问被拒绝(使用密码 : YES)

javascript - 是否可以从 VueJS 中的路由获取完整的 url(包括来源)?

javascript - 当事件 $emit 发出时,Vue $on 不运行我的函数,即使我可以看到在 Vue 控制台中触发的事件

node.js - Node 在使用 webpack 时找不到模块 “fs”

javascript - webpack 中的 css 配置不检测类样式但检测元素样式