You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

93 lines
2.1 KiB

const path = require('path');
const webpack = require('webpack');
const {
BundleAnalyzerPlugin,
} = require('webpack-bundle-analyzer');
const PATHS = {
app: path.join(__dirname, 'client/src'),
build: path.join(__dirname, 'client/build'),
};
module.exports = {
mode: 'development',
devtool: 'source-map',
devServer: {
historyApiFallback: true,
hot: true,
},
entry: {
app: ['@babel/polyfill', PATHS.app],
},
output: {
publicPath: '/client/build/',
path: PATHS.build,
filename: '[name].js',
},
resolve: {
modules: [path.resolve(__dirname, 'client/src'), path.resolve(__dirname, 'node_modules')],
extensions: ['.js', '.jsx'],
symlinks: false,
alias: {
crypto: false,
'@': path.resolve(__dirname, 'client/assets'),
$utils: path.resolve(__dirname, 'client/src/utils/'),
$components: path.resolve(__dirname, 'client/src/components/'),
$themes: path.resolve(__dirname, 'client/src/themes/'),
},
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new BundleAnalyzerPlugin(),
],
module: {
rules: [{
test: /\.css$/,
use: ['style-loader', {
loader: 'css-loader',
options: {
modules: true,
},
}],
},
{
test: /\.less$/,
use: ['style-loader', 'css-loader', {
loader: 'less-loader',
options: {
lessOptions: {
javascriptEnabled: true,
},
},
}],
},
{
test: /\.(js|jsx)$/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@babel/preset-react',
],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
['import', {
libraryName: 'antd',
libraryDirectory: 'es',
}],
],
},
},
// use: 'babel-loader',
include: [PATHS.app, path.resolve(__dirname, 'node_modules', '@peace')],
}, {
test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/,
loader: 'file-loader',
},
],
},
};