mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-30 11:08:00 +08:00
109 lines
2.6 KiB
JavaScript
109 lines
2.6 KiB
JavaScript
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const VueLoaderPlugin = require('vue-loader/dist/plugin').default;
|
|
const webpack = require('webpack');
|
|
const WebpackBar = require('webpackbar');
|
|
const path = require('path');
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
entry: {
|
|
app: './examples/index.js',
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.vue$/,
|
|
loader: 'vue-loader',
|
|
},
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
targets: {
|
|
browsers: [
|
|
'last 2 versions',
|
|
'Firefox ESR',
|
|
'> 1%',
|
|
'ie >= 9',
|
|
'iOS >= 8',
|
|
'Android >= 4',
|
|
],
|
|
},
|
|
},
|
|
],
|
|
],
|
|
plugins: [
|
|
['@ant-design-vue/babel-plugin-jsx', { transformOn: true, compatibleProps: true }],
|
|
'@babel/plugin-transform-object-assign',
|
|
'@babel/plugin-proposal-object-rest-spread',
|
|
'@babel/plugin-proposal-export-default-from',
|
|
'@babel/plugin-proposal-class-properties',
|
|
],
|
|
},
|
|
},
|
|
{
|
|
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: {
|
|
lessOptions: {
|
|
sourceMap: true,
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['css-loader'],
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'ant-design-vue': path.join(__dirname, './components'),
|
|
// vue$: 'vue/dist/vue.esm.js',
|
|
},
|
|
extensions: ['.js', '.jsx', '.vue'],
|
|
},
|
|
devServer: {
|
|
host: 'localhost',
|
|
port: 3002,
|
|
historyApiFallback: {
|
|
rewrites: [{ from: /./, to: '/index.html' }],
|
|
},
|
|
disableHostCheck: true,
|
|
hot: true,
|
|
open: true,
|
|
},
|
|
devtool: '#source-map',
|
|
plugins: [
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
new HtmlWebpackPlugin({
|
|
template: 'examples/index.html',
|
|
filename: 'index.html',
|
|
inject: true,
|
|
}),
|
|
new VueLoaderPlugin(),
|
|
new WebpackBar(),
|
|
],
|
|
};
|