您好我一直在努力从Pedro G. Galaviz那里获得配置Phoenix和Vue.js https://github.com/pggalaviz/phoenix-vue
的示例在我的版本(https://github.com/kieranwild/phoenix-vue)中,我已经从简单的webpack-simple模板https://github.com/vuejs-templates/webpack-simple复制了webpack / babel配置,但它仍然不起作用。
我在这里运行:http://165.227.226.0/ 它正在加载标题,但只是在ie11上显示一个空白屏幕,没有错误消息。
main.js
import 'babel-polyfill’
import ‘es6-promise/auto’
import Phoenix_html from 'phoenix_html’
import { Socket } from 'phoenix’
import Vue from 'vue’
import App from ‘./App’
Vue.config.productionTip = false
new Vue({
el: ‘#app’,
template: ‘’,
components: { App }
})
webpack.config.js
var path = require(‘path’)
var webpack = require(‘webpack’)
module.exports = {
entry: [‘babel-polyfill’, ‘./src/main.js’],
output: {
path: path.resolve(__dirname, ‘./dist’),
publicPath: ‘/dist/’,
filename: ‘build.js’
},
module: {
rules: [
{
test: /.css$/,
use: [
‘vue-style-loader’,
‘css-loader’
],
},
{
test: /.scss$/,
use: [
‘vue-style-loader’,
‘css-loader’,
‘sass-loader’
],
},
{
test: /.sass$/,
use: [
‘vue-style-loader’,
‘css-loader’,
‘sass-loader?indentedSyntax’
],
},
{
test: /.vue$/,
loader: ‘vue-loader’,
options: {
loaders: {
configs here.
‘scss’: [
‘vue-style-loader’,
‘css-loader’,
‘sass-loader’
],
‘sass’: [
‘vue-style-loader’,
‘css-loader’,
‘sass-loader?indentedSyntax’
]
}
}
},
{
test: /.js$/,
loader: ‘babel-loader’,
exclude: /node_modules/
},
{
test: /.(png|jpg|gif|svg)$/,
loader: ‘file-loader’,
options: {
name: ‘[name].[ext]?[hash]’
}
}
]
},
resolve: {
alias: {
‘vue$’: ‘vue/dist/vue.esm.js’
},
extensions: [’*’, ‘.js’, ‘.vue’, ‘.json’]
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: ‘#eval-source-map’
}
if (process.env.NODE_ENV === ‘production’) {
module.exports.devtool = ‘#source-map’
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
‘process.env’: {
NODE_ENV: ‘“production”’
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
答案 0 :(得分:0)
我认为Webpack存在问题。我已经恢复了早午餐。