2021-07-16 16:41:58 +02:00
|
|
|
const path = require('path');
|
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2021-09-23 19:33:02 +02:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
|
|
|
|
const namesHTML = [
|
|
|
|
'arrow',
|
|
|
|
'curvedLine',
|
|
|
|
'events',
|
|
|
|
'font',
|
|
|
|
'group',
|
|
|
|
'line',
|
|
|
|
'polyLine',
|
|
|
|
'prototype',
|
|
|
|
'rect',
|
|
|
|
'shapes',
|
|
|
|
'text',
|
|
|
|
'workspace',
|
|
|
|
];
|
|
|
|
|
|
|
|
const multiHtmlPlugin = namesHTML.map((name) => {
|
|
|
|
return new HtmlWebpackPlugin({
|
|
|
|
chunks: ['testing'],
|
|
|
|
filename: `${name}`,
|
|
|
|
template: `test/javascript/render/${name}.html`,
|
|
|
|
});
|
|
|
|
});
|
2021-07-16 16:41:58 +02:00
|
|
|
|
|
|
|
/** @type {import('webpack').Configuration} */
|
|
|
|
module.exports = {
|
2021-09-23 19:33:02 +02:00
|
|
|
entry: {
|
|
|
|
testing: './test/javascript/render/testing.js',
|
|
|
|
},
|
2021-07-16 16:41:58 +02:00
|
|
|
output: {
|
2021-09-08 22:45:26 +02:00
|
|
|
path: path.resolve(__dirname, 'dist', 'tests'),
|
2021-09-23 19:33:02 +02:00
|
|
|
filename: 'testing.js',
|
|
|
|
publicPath: '/',
|
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
historyApiFallback: true,
|
|
|
|
port: 8080,
|
|
|
|
open: true,
|
2021-07-16 16:41:58 +02:00
|
|
|
},
|
2021-09-23 19:33:02 +02:00
|
|
|
mode: 'development',
|
|
|
|
target: 'web',
|
2021-07-16 16:41:58 +02:00
|
|
|
devtool: 'source-map',
|
|
|
|
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 19:33:02 +02:00
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new HtmlWebpackPlugin({ template: 'test/javascript/render/index.html' }),
|
|
|
|
].concat(multiHtmlPlugin),
|
2021-07-16 16:41:58 +02:00
|
|
|
};
|