2023-01-15 18:59:48 +01:00
|
|
|
/** @type {import('webpack').Configuration} */
|
2021-02-16 21:01:32 +01:00
|
|
|
|
2023-01-15 18:59:48 +01:00
|
|
|
const path = require('path');
|
|
|
|
const { merge } = require('webpack-merge');
|
|
|
|
const common = require('../../webpack.common');
|
2020-12-12 21:23:38 +01:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2020-12-09 04:35:02 +01:00
|
|
|
|
2023-01-15 18:59:48 +01:00
|
|
|
const prodConfig = {
|
2022-07-13 03:58:11 +02:00
|
|
|
entry: {
|
|
|
|
app: path.join(__dirname, 'src', 'index.tsx'),
|
|
|
|
},
|
|
|
|
target: 'web',
|
|
|
|
output: {
|
|
|
|
filename: '[name].bundle.js',
|
|
|
|
path: path.resolve(__dirname, 'dist'),
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.wxml$/i,
|
|
|
|
type: 'asset/source',
|
2023-01-15 18:59:48 +01:00
|
|
|
}
|
2022-07-13 03:58:11 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
optimization: {
|
2022-08-16 05:00:49 +02:00
|
|
|
chunkIds: 'named',
|
2022-07-13 03:58:11 +02:00
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
|
|
|
vendors: {
|
|
|
|
test: /node_modules\/.*/,
|
|
|
|
name: 'vendors',
|
|
|
|
chunks: 'all',
|
2022-01-26 20:25:11 +01:00
|
|
|
},
|
2022-07-13 03:58:11 +02:00
|
|
|
},
|
2021-02-16 20:11:13 +01:00
|
|
|
},
|
2022-07-13 03:58:11 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: 'public/*',
|
|
|
|
to: '[name].[ext]',
|
|
|
|
globOptions: {
|
|
|
|
ignore: ['**/index.html'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
],
|
2022-01-26 20:25:11 +01:00
|
|
|
};
|
2023-01-15 18:59:48 +01:00
|
|
|
|
|
|
|
module.exports = merge(common, prodConfig);
|