vue+webpack+express搭建的项目,webpack打包时报错,求大神帮助啊!
发布于 2 年前 作者 GivenchyLiu 2763 次浏览 来自 问答

webpack.config.js配置 var webpack = require(‘webpack’); var path = require(‘path’); module.exports={ entry: path.resolve(__dirname, ‘client/views/main.js’), output:{ path : path.resolve(__dirname, ‘client/build/’), filename:‘main.min.js’ }, resolve: { extensions: [’ ', ‘.js’, ‘.vue’, ‘.json’,‘sass’], //fallback: [path.join(__dirname, ‘…/node_modules’)], alias: { ‘vue’: path.join(__dirname, ‘node_modules/vue/dist/vue.min.js’) //‘js’: path.resolve(__dirname, ‘…/js’) } }, module: { loaders: [{ test: /.css$/, loader: ‘style-loader!css-loader}’ }, { test: /.scss/, loader: ‘style-loader!css-loader!sass-loader?outputStyle=expanded’ }, { test: /.json$/, loader: ‘json-loader’ }, { test: /.(png|jpg|woff|woff2|eot|ttf|svg)$/, loader: ‘url-loader?limit=8192’ },{ test: /.vue$/, loader: ‘vue!babel-loader’ },{ test: /.(js|jsx)$/, exclude: /node_modules/, loader: ‘babel-loader’, query: { presets: [ ‘es2015’] } },{ test: /.html$/, loader:‘vue-html-loader’ }] }, plugins: [ new webpack.HotModuleReplacementPlugin() ], cache: true, //debug: true, devtool: ‘sourcemap’ }

main.js代码 import Vue from ‘vue’; import App from ‘./App’; import router from ‘./router’; import axios from ‘axios’; Vue.prototype.$http = axios;

new Vue({ el: ‘#app’, router, template: ‘<App/>’, components: { App } })

app.vue代码: <template> <div id=“app”> <router-view></router-view> </div> </template> <script> import Welcome from ‘vue/welcome.vue’; import store from ‘vuex/store.js’; export default{ components : { wel : Welcome }, store : store } </script> <style> </style> 报错如图无标题.png

1 回复

<template>前面不能有空格

回到顶部