amis-rpc-design/build/webpack.prod.js

68 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2023-10-07 19:42:30 +08:00
const path = require('path');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
index: path.resolve(__dirname, '../src/index.tsx')
},
module: {
// modulePathIgnorePatterns: ['libs'],
rules: [
{
test: /\.(ts|tsx)$/,
include: [path.resolve(__dirname, '../src')],
enforce: 'pre',
use: ['babel-loader']
},
{
test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: 'url-loader?limit=10000',
include: path.resolve(__dirname, 'src')
},
{
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
use: 'file-loader',
include: path.resolve(__dirname, '../src')
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
// include: path.resolve(__dirname, 'src')
},
{
test: /\.ttf$/,
use: ['file-loader']
}
]
},
plugins: [
new CleanWebpackPlugin({cleanStaleWebpackAssets: false}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './template.html'),
}),
new MonacoWebpackPlugin(),
new ForkTsCheckerWebpackPlugin(),
new ReactRefreshWebpackPlugin(),
],
resolve: {
extensions: ['.tsx', '.ts', '.js', '.html'],
modules: [
'node_modules',
path.resolve(__dirname, '../libs/amis/packages')
],
alias: {
"@amis": path.resolve(__dirname, '../libs/amis/packages')
}
},
output: {
filename: '[name].[chunkhash:8].bundle.js',
publicPath: '/',
path: path.resolve(__dirname, '../dist'),
clean: true
}
};