2017-10-26 15:18:08 +08:00
|
|
|
const path = require('path')
|
2018-01-22 15:47:22 +08:00
|
|
|
// const webpack = require('webpack')
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
2018-01-23 18:55:39 +08:00
|
|
|
const merge = require('webpack-merge')
|
|
|
|
const baseWebpackConfig = require('./webpack.base.config')
|
2017-10-26 15:18:08 +08:00
|
|
|
|
2018-01-23 18:55:39 +08:00
|
|
|
module.exports = merge(baseWebpackConfig, {
|
2017-10-26 15:18:08 +08:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, './dist'),
|
2018-01-22 15:47:22 +08:00
|
|
|
publicPath: '/',
|
2017-10-26 15:18:08 +08:00
|
|
|
filename: 'build.js',
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.less$/,
|
|
|
|
use: [
|
|
|
|
{ loader: 'style-loader' },
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: { sourceMap: true },
|
|
|
|
},
|
|
|
|
{ loader: 'less-loader',
|
|
|
|
options: { sourceMap: true },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-01-23 18:55:39 +08:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
|
|
|
],
|
|
|
|
},
|
2017-10-26 15:18:08 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
port: 3000,
|
|
|
|
historyApiFallback: {
|
2018-01-22 15:47:22 +08:00
|
|
|
rewrites: [
|
|
|
|
{ from: /.*/, to: '/index.html' },
|
|
|
|
],
|
2017-10-26 15:18:08 +08:00
|
|
|
},
|
|
|
|
disableHostCheck: true,
|
|
|
|
headers: { 'Access-Control-Allow-Origin': '*' },
|
|
|
|
},
|
|
|
|
performance: {
|
|
|
|
hints: false,
|
|
|
|
},
|
2018-01-08 18:31:04 +08:00
|
|
|
devtool: '#source-map',
|
2018-01-23 18:55:39 +08:00
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: 'examples/index.html',
|
|
|
|
filename: 'index.html',
|
|
|
|
inject: true,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
})
|