1
我已經在全球安裝了webpack,並且在本地安裝了vue和loader,並嘗試過在全球範圍內安裝它們。當我運行的WebPackWebpack vue error
Module parse failed: /Users/joebob/Development/vue-test/node_modules/babel-loader/index.js!/Users/joebob/Development/vue-test/src/main.js Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import Vue from 'vue';
main.js我不斷收到此錯誤
import Vue from 'vue'
import App from './app.vue'
new Vue({
el: 'body',
components: { App }
})
配置
module.exports = {
entry: './src/main.js',
output: {
path: './dist',
publicPath: 'dist/',
filename: 'build.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue'
}
]
},
vue: {
loaders: {
js: 'babel'
}
}
}
的package.json
{
"name": "vue-test",
"version": "1.0.0",
"dependencies": {
"vue": "^1.0.16"
},
"devDependencies": {
"babel-core": "^6.1.2",
"babel-loader": "^6.1.0",
"babel-plugin-transform-runtime": "^6.1.2",
"babel-preset-es2015": "^6.1.2",
"babel-preset-stage-0": "^6.1.2",
"babel-runtime": "^5.8.0",
"webpack": "^1.12.2",
"css-loader": "^0.23.0",
"style-loader": "^0.13.0",
"vue-loader": "^7.3.0",
"vue-html-loader": "^1.0.0",
"vue-hot-reload-api": "^1.2.0"
}
}
不知道我是什麼缺少
哪個版本可以與
然後設置巴貝爾裝載機使用它安裝你在用babel嗎?你可以發佈你的package.json嗎? –
用package.json更新 – ThingWings