2021-09-07 22:31:46 +02:00
|
|
|
const path = require('path');
|
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2021-09-23 22:51:24 +02:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2021-09-07 22:31:46 +02:00
|
|
|
|
|
|
|
/** @type {import('webpack').Configuration} */
|
|
|
|
module.exports = {
|
2021-09-08 22:45:26 +02:00
|
|
|
entry: {
|
2021-10-03 03:37:42 +02:00
|
|
|
palette: path.resolve(__dirname, './test/playground/lib/testPalette'),
|
|
|
|
layout: path.resolve(__dirname, './test/playground/lib/testLayout'),
|
2021-09-08 22:45:26 +02:00
|
|
|
},
|
2021-09-07 22:31:46 +02:00
|
|
|
output: {
|
2021-09-23 22:51:24 +02:00
|
|
|
path: path.resolve(__dirname, 'dist', 'test'),
|
|
|
|
filename: '[name].test.js',
|
2021-09-07 22:31:46 +02:00
|
|
|
publicPath: '',
|
|
|
|
},
|
2021-09-23 22:51:24 +02:00
|
|
|
mode: 'production',
|
2021-09-02 18:32:23 +02:00
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all',
|
|
|
|
minSize: 2000000,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
devtool: 'source-map',
|
2021-09-07 22:31:46 +02:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
use: 'babel-loader',
|
|
|
|
test: /.(js|jsx)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'asset',
|
|
|
|
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.json'],
|
|
|
|
},
|
2021-09-23 22:51:24 +02:00
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new HtmlWebpackPlugin({
|
2021-10-03 03:37:42 +02:00
|
|
|
template: 'test/playground/index.html',
|
2021-09-23 22:51:24 +02:00
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
chunks: ['layout'],
|
|
|
|
filename: 'layout',
|
2021-10-03 03:37:42 +02:00
|
|
|
template: 'test/playground/layout.html',
|
2021-09-23 22:51:24 +02:00
|
|
|
}),
|
|
|
|
],
|
2021-09-07 22:31:46 +02:00
|
|
|
};
|