2020-03-23 03:00:24 +00:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2020-05-27 11:11:46 +00:00
|
|
|
const VueLoaderPlugin = require('vue-loader/dist/plugin').default;
|
2020-03-23 03:00:24 +00:00
|
|
|
const WebpackBar = require('webpackbar');
|
|
|
|
const path = require('path');
|
2020-07-07 08:00:49 +00:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2020-03-23 03:00:24 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: 'development',
|
|
|
|
entry: {
|
|
|
|
app: './examples/index.js',
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2020-06-20 07:14:51 +00:00
|
|
|
test: /\.(vue|md)$/,
|
2020-03-23 03:00:24 +00:00
|
|
|
loader: 'vue-loader',
|
2020-07-26 13:35:41 +00:00
|
|
|
exclude: /\.(en-US.md|zh-CN.md)$/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(en-US.md|zh-CN.md)$/,
|
|
|
|
use: [{ loader: 'vue-loader' }, { loader: './loader.js' }],
|
2020-03-23 03:00:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(js|jsx)$/,
|
|
|
|
loader: 'babel-loader',
|
2020-07-02 07:05:23 +00:00
|
|
|
exclude: /pickr.*js/,
|
2020-03-23 03:00:24 +00:00
|
|
|
options: {
|
2020-06-25 13:23:39 +00:00
|
|
|
cacheDirectory: true,
|
2020-03-23 03:00:24 +00:00
|
|
|
presets: [
|
|
|
|
[
|
2020-05-27 11:11:46 +00:00
|
|
|
'@babel/preset-env',
|
2020-03-23 03:00:24 +00:00
|
|
|
{
|
|
|
|
targets: {
|
|
|
|
browsers: [
|
|
|
|
'last 2 versions',
|
|
|
|
'Firefox ESR',
|
|
|
|
'> 1%',
|
|
|
|
'ie >= 9',
|
|
|
|
'iOS >= 8',
|
|
|
|
'Android >= 4',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
plugins: [
|
2020-06-25 13:23:39 +00:00
|
|
|
[
|
|
|
|
'babel-plugin-import',
|
|
|
|
{
|
|
|
|
libraryName: 'ant-design-vue',
|
|
|
|
libraryDirectory: '', // default: lib
|
|
|
|
style: true,
|
|
|
|
},
|
|
|
|
],
|
2020-07-15 10:23:15 +00:00
|
|
|
['@ant-design-vue/babel-plugin-jsx', { transformOn: true, usePatchFlag: false }],
|
2020-06-13 14:32:10 +00:00
|
|
|
'@babel/plugin-proposal-optional-chaining',
|
2020-05-27 11:11:46 +00:00
|
|
|
'@babel/plugin-transform-object-assign',
|
|
|
|
'@babel/plugin-proposal-object-rest-spread',
|
|
|
|
'@babel/plugin-proposal-export-default-from',
|
|
|
|
'@babel/plugin-proposal-class-properties',
|
2020-03-23 03:00:24 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|svg)$/,
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]?[hash]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.less$/,
|
|
|
|
use: [
|
2020-05-27 11:11:46 +00:00
|
|
|
{ loader: 'style-loader' },
|
2020-03-23 03:00:24 +00:00
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: { sourceMap: true },
|
|
|
|
},
|
2020-05-06 03:09:24 +00:00
|
|
|
{
|
|
|
|
loader: 'less-loader',
|
|
|
|
options: {
|
|
|
|
lessOptions: {
|
|
|
|
sourceMap: true,
|
|
|
|
javascriptEnabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-03-23 03:00:24 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2020-07-07 08:00:49 +00:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
hmr: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'css-loader',
|
|
|
|
],
|
2020-03-23 03:00:24 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2020-07-28 10:37:07 +00:00
|
|
|
'ant-design-vue/es/locale/en_US': path.join(
|
|
|
|
__dirname,
|
|
|
|
'./components/locale-provider/en_US.js',
|
|
|
|
),
|
|
|
|
'ant-design-vue/es/locale/zh_CN': path.join(
|
|
|
|
__dirname,
|
|
|
|
'./components/locale-provider/zh_CN.js',
|
|
|
|
),
|
2020-03-23 03:00:24 +00:00
|
|
|
'ant-design-vue': path.join(__dirname, './components'),
|
2020-07-28 10:37:07 +00:00
|
|
|
|
2020-08-14 05:43:20 +00:00
|
|
|
vue$: 'vue/dist/vue.esm-bundler.js',
|
2020-03-23 03:00:24 +00:00
|
|
|
},
|
2020-06-20 07:14:51 +00:00
|
|
|
extensions: ['.js', '.jsx', '.vue', '.md'],
|
2020-03-23 03:00:24 +00:00
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
historyApiFallback: {
|
|
|
|
rewrites: [{ from: /./, to: '/index.html' }],
|
|
|
|
},
|
|
|
|
disableHostCheck: true,
|
|
|
|
hot: true,
|
|
|
|
open: true,
|
|
|
|
},
|
2020-07-07 08:00:49 +00:00
|
|
|
devtool: 'cheap-module-eval-source-map',
|
2020-03-23 03:00:24 +00:00
|
|
|
plugins: [
|
2020-07-07 08:00:49 +00:00
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].css',
|
|
|
|
}),
|
2020-03-23 03:00:24 +00:00
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: 'examples/index.html',
|
|
|
|
filename: 'index.html',
|
|
|
|
inject: true,
|
|
|
|
}),
|
|
|
|
new VueLoaderPlugin(),
|
|
|
|
new WebpackBar(),
|
|
|
|
],
|
|
|
|
};
|