2017-06-14 62 views
0

的WebPack安可配置,我有以下错误,当我从symfony中提供了一个基本的symfony应用程序与VueJS和包的WebPack安可加载页面为VueJS

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

所以我需要改变的别名VueJS into webpack with this:

resolve: { 
    alias: { 
    vue: 'vue/dist/vue.js' 
    } 
} 

但是我没有找到任何东西进入Webpack Encore来改变这个设置。

的WebPack喝采:http://symfony.com/doc/current/frontend.html

回答

1

是否加入这一行到您的package.json解决这个问题?

"browser": { 
    "vue": "vue/dist/vue.common" 
} 

这是捆扎机的特殊领域。所以在这里,我们用包含编译器的内部版本来替换vue的默认运行时版本。

当您为浏览器字段指定单个字符串时,它将替换main并且作为模块入口点 。主字段指定 模块的入口点,因此通过替换它,您可以替换 入口点,当模块由捆绑器打包以供浏览器使用时。

见规格:https://github.com/defunctzombie/package-browser-field-spec

+0

是的,你能解释一下它是如何工作的? – Dayze

+0

我添加了一个解释(我不知道自己是如何工作的)。 – Cobaltway