123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- const Webpack = require('webpack')
- const path = require('path')
- const merge = require('webpack-merge')
- const MiniCssExtractPlugin = require('mini-css-extract-plugin')
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
- const { getThemeVariables } = require('antd/dist/theme')
- const baseConfig = require('./webpack.config')
- const config = merge(baseConfig, {
- entry: {
- index: path.resolve(__dirname, '../src/index.tsx'),
- publicity: path.resolve(__dirname, '../src/publicity.tsx'),
- },
- output: {
- publicPath: '/',
- filename: 'static/js/[name].js',
- chunkFilename: 'static/js/[name].chunk.js',
- path: __dirname + '/dist',
- },
- devServer: {
- contentBase: path.join(__dirname, '../dist'),
- disableHostCheck: true,
- watchContentBase: false,
- host: '127.0.0.1',
- port: 61001,
- hot: true,
- open: true,
- inline: true,
- historyApiFallback: true,
- stats: 'errors-only',
- proxy: {
- '/api': {
- target: 'http://47.108.135.38:61001',
- },
- },
- },
- mode: 'development',
- devtool: 'cheap-module-eval-source-map',
- module: {
- rules: [
- {
- test: /\.less$/,
- use: [
- {
- loader: 'style-loader',
- },
- {
- loader: 'css-loader', // translates CSS into CommonJS
- },
- {
- loader: 'less-loader', // compiles Less to CSS
- options: {
- lessOptions: {
- javascriptEnabled: true,
- },
- },
- },
- ],
- },
- {
- test: /\.scss$/i,
- use: ['style-loader', 'css-loader', 'sass-loader'],
- exclude: path.resolve(__dirname, '../node_modules'),
- },
- {
- test: /\.css$/i,
- use: ['style-loader', 'css-loader'],
- },
- ],
- },
- plugins: [
- new ForkTsCheckerWebpackPlugin({
- async: false,
- silent: false,
- useTypescriptIncrementalApi: false,
- checkSyntacticErrors: true,
- formatter: undefined,
- }),
- new Webpack.HotModuleReplacementPlugin(),
- new Webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify('development'),
- }),
- new MiniCssExtractPlugin({
- filename: 'css/[name].css',
- chunkFilename: 'css/[name].css',
- }),
- ],
- })
- module.exports = config
|