如何在Vue上使用早午餐

问题描述 投票:0回答:1

我正在尝试使用Vue和Django的早午餐,但我得到一个空白页面,当我尝试在我的js中放置断点时,我看到它失败了:

import Vue from 'vue/dist/vue.js' 

'Uncaught SyntaxError:Unexpected identifier'

我的HTML是:

<html lang="en">
    <head>
        ...
        <link rel="stylesheet" type="text/css" href="{% static 'public/css/app.css' %}" />
    </head>
    <body>
        <div id="app">
          <router-view></router-view>
        </div>
        <script type="text/javascript" src="{% static 'public/js/vendors.js' %}"></script>
        <script type="text/javascript" src="{% static 'public/js/app.js' %}"></script>
    </body>
</html>

我的js是:

import Vue from 'vue/dist/vue.js'
import VueRouter from 'vue-router'
Vue.use(VueRouter);
...
const app = new Vue({
    router,
    ...
}).$mount('#app');

我的早午餐配置是:

module.exports = {
    files: {
        javascripts: {
            joinTo: { 
                "js/vendors.js": /^node_modules/,
                'js/app.js': /^js/
            }
        },
        stylesheets: {joinTo: { 'css/app.css': 'scss/main.scss'}},
        templates: {
            joinTo: 'js/app.js'
        }
    },
    paths: {
        watched: ['js', 'scss']
    },
    plugins: {
        babel: {
            presets: ['es2015']
        }
    }
};

出于某些原因,在浏览器源代码中,我看到我的js已编译,整个node_modules dir已编译,而原始js文件夹未编译。知道我做错了什么吗?

谢谢。

django vue.js brunch
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.