node.js - webpack 配置文件 運行出錯
問題描述
項目目錄
webpack.config.js
// nodejs 中的path模塊var path = require(’path’);module.exports = { // 入口文件,path.resolve()方法,可以結合我們給定的兩個參數最后生成絕對路徑,最終指向的就是我們的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 結尾的文件 {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 }})
錯誤
請教大神 剛學習 vue想搭個項目跑一跑結果就這樣
問題解答
回答1:看錯誤提示的最后一行已經告訴了你,
resolve: { extensions: [’’, ’.js’, ’.vue’]},
第一個元素不能為‘’,把它放到最后一個位置
回答2:configuration.resolve.extension[0] 不就是對應你的extensions: [’’, ’.js’, ’.vue’]這個數組里的第一個值么?按照提示,就是這里不能為空吧。
相關文章:
1. 注冊賬戶文字不能左右分離2. html - vue項目中用到了elementUI問題3. 對mysql某個字段監控的功能4. javascript - 數組的過濾和渲染5. javascript - table列過多,有什么插件可以提供列排序和選擇顯示列的功能6. python - 使用readlines()方法讀取文件內容后,再用for循環遍歷文件與變量匹配時出現疑難?7. showpassword里的this 是什么意思?代表哪個元素8. html5 - ElementUI table中el-table-column怎么設置百分比顯示。9. python - 為什么正常輸出中文沒有亂碼,zip函數之后出現中文編程unicode編碼的問題,我是遍歷輸出的啊。10. JavaScript事件
