then solve the cross-domain problem. I'll add a proxyTable function for you later according to your webpack-simple configuration.
< hr >
webpack.config.js
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './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: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other vue-loader options go here
}
},
{
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,
// --------------------
proxy: {
'/api':{
target: 'http://localhost:7001',
pathRewrite: {
'/api': ''
}
}
}
//----------------------------------
},
performance: {
hints: false
},
devtool: '-sharpeval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '-sharpsource-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
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
})
])
}
I generated it directly with the scaffolding you mentioned, and I added proxy
directly on this basis. Is there any doubt?
console is not very clear. Are you cross-domain?
this is not a cross-domain problem, but how the url of your get is cached. The returned status code is 304.
it is estimated that vue-resource will only let 200 go success
.