node.js - webpack 配置文件 運行出錯
問題描述
項目目錄

webpack.config.js
// nodejs 中的path模塊var path = require(’path’);module.exports = { // 入口文件,path.resolve()方法,可以結(jié)合我們給定的兩個參數(shù)最后生成絕對路徑,最終指向的就是我們的index.js文件 entry: path.resolve(__dirname, ’../app/index/index.js’), // 輸出配置 output: {// 輸出路徑是 myProject/output/staticpath: path.resolve(__dirname, ’../output/static’),publicPath: ’static/’,filename: ’[name].[hash].js’,chunkFilename: ’[id].[chunkhash].js’ }, resolve: {extensions: [’’, ’.js’, ’.vue’] }, module: {loaders: [ // 使用vue-loader 加載 .vue 結(jié)尾的文件 {test: /.vue$/,loader: ’vue’ }, {test: /.js$/,loader: ’babel?presets=es2015’,exclude: /node_modules/ }] }}
index.js
import Vue from ’Vue’import Favlist from ’../components/Favlist’ new Vue({ el: ’body’, components: {Favlist }})
錯誤
請教大神 剛學(xué)習(xí) vue想搭個項目跑一跑結(jié)果就這樣


問題解答
回答1:看錯誤提示的最后一行已經(jīng)告訴了你,
resolve: { extensions: [’’, ’.js’, ’.vue’]},
第一個元素不能為‘’,把它放到最后一個位置
回答2:configuration.resolve.extension[0] 不就是對應(yīng)你的extensions: [’’, ’.js’, ’.vue’]這個數(shù)組里的第一個值么?按照提示,就是這里不能為空吧。
相關(guān)文章:
1. javascript - immutable配合react提升性能?2. javascript - sublime快鍵鍵問題3. 配置Apache時,添加對PHP的支持時語法錯誤4. Apache 已經(jīng)把網(wǎng)站根目錄的改為allow from all了,但是服務(wù)器還是不能訪問?5. css - 寫頁面遇到個布局問題,求大佬們幫解答,在線等,急!~6. phpstudy8.1支持win11系統(tǒng)嗎?7. javascript - nodejs關(guān)于進(jìn)程間發(fā)送句柄的一點疑問8. 實現(xiàn)bing搜索工具urlAPI提交9. vue.js - Vue 如何像Angular.js watch 一樣監(jiān)聽數(shù)據(jù)變化10. javascript - 移動端上不能實現(xiàn)拖拽布局嗎?

網(wǎng)公網(wǎng)安備