wisemapping-frontend/packages/webapp/webpack.common.js

53 lines
1.0 KiB
JavaScript
Raw Normal View History

/** @type {import('webpack').Configuration} */
2021-02-16 21:01:32 +01:00
const path = require('path');
const { merge } = require('webpack-merge');
const common = require('../../webpack.common');
const CopyWebpackPlugin = require('copy-webpack-plugin');
2020-12-09 04:35:02 +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',
}
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: {
2023-02-10 04:35:35 +01:00
test: /node_modules\/.*/,
2022-07-13 03:58:11 +02:00
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
};
module.exports = merge(common, prodConfig);