ant-design-vue/webpack.config.js

78 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-10-26 07:18:08 +00:00
const path = require('path')
2018-01-22 07:47:22 +00:00
// const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
2017-10-26 07:18:08 +00:00
module.exports = {
entry: {
index: [
'./examples/index.js',
],
},
output: {
path: path.resolve(__dirname, './dist'),
2018-01-22 07:47:22 +00:00
publicPath: '/',
2017-10-26 07:18:08 +00:00
filename: 'build.js',
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.js$/,
loader: 'babel-loader', exclude: /node_modules/,
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
},
},
{
test: /\.less$/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: { sourceMap: true },
},
{ loader: 'less-loader',
options: { sourceMap: true },
},
],
},
],
},
resolve: {
extensions: ['.js', '.vue'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
2017-11-03 04:04:39 +00:00
'antd': path.join(__dirname, 'components'),
2017-10-26 07:18:08 +00:00
},
},
devServer: {
port: 3000,
historyApiFallback: {
2018-01-22 07:47:22 +00:00
rewrites: [
{ from: /.*/, to: '/index.html' },
],
2017-10-26 07:18:08 +00:00
},
disableHostCheck: true,
headers: { 'Access-Control-Allow-Origin': '*' },
},
performance: {
hints: false,
},
2018-01-08 10:31:04 +00:00
devtool: '#source-map',
2017-10-26 07:18:08 +00:00
}
2018-01-22 07:47:22 +00:00
module.exports.plugins = (module.exports.plugins || []).concat([
new HtmlWebpackPlugin({
template: 'examples/index.html',
filename: 'index.html',
inject: true,
}),
])