我正在用Vue做实验,想用我常用的设置来开发一个节点应用程序,它使用budo(浏览器+ watchify)。./index.html:
<div id="app">
{{ message }}
</div>
<!-- ===================== JavaScript Files Below This Line =============== -->
<script src="index.js"></script>和./src/js/main.js
const Vue = require('vue');
const app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
}
});
module.exports = app;使用./index.js
// js includes
require('./src/js/main');我看不到页面上的信息。我在控制台中看到注入了main.js的index.js。当我在index.html中使用Vue CDN和vue代码时,它工作得很好。我希望有人能解释一下在捆绑browserify时如何使用CommonJS模块将vue代码导入到他们的应用中。先谢谢你...
发布于 2018-08-04 05:39:16
正如这里所解释的那样,您需要将以下代码添加到package.json文件中:
"browser": {
"vue": "vue/dist/vue.common.js"
}https://stackoverflow.com/questions/51663682
复制相似问题