wisemapping-frontend/packages/web2d/webpack.test.js

67 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-07-16 16:41:58 +02:00
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
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 = {
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'),
filename: 'testing.js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
port: 8080,
open: true,
2021-07-16 16:41:58 +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'],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ template: 'test/javascript/render/index.html' }),
].concat(multiHtmlPlugin),
2021-07-16 16:41:58 +02:00
};