2017-08-29 23:43:25 +08:00
|
|
|
const path = require('path');
|
2018-08-16 22:08:03 +08:00
|
|
|
const HtmlWebPackPlugin = require("html-webpack-plugin");
|
2017-08-29 23:43:25 +08:00
|
|
|
|
2018-08-16 22:08:03 +08:00
|
|
|
module.exports = {
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: "babel-loader"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
|
|
|
use: {
|
|
|
|
loader: 'file-loader'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
|
|
|
use: {
|
|
|
|
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif)$/,
|
|
|
|
use: {
|
|
|
|
loader: 'url-loader?limit=8192'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: "html-loader"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebPackPlugin({
|
|
|
|
template: "./src/index.html",
|
|
|
|
filename: "./index.html"
|
|
|
|
})
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.css'],
|
|
|
|
modules: [
|
|
|
|
'node_modules',
|
|
|
|
path.resolve(__dirname, 'src/')
|
|
|
|
]
|
|
|
|
},
|
2018-08-16 23:30:51 +08:00
|
|
|
output: {
|
|
|
|
publicPath: '/'
|
|
|
|
},
|
2018-08-16 22:08:03 +08:00
|
|
|
devServer: {
|
|
|
|
proxy: {
|
|
|
|
'/api': {
|
|
|
|
target: 'https://localhost:5000',
|
|
|
|
secure: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|