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}`,
|
2021-10-03 02:57:29 +02:00
|
|
|
template: `test/playground/${name}.html`,
|
2021-09-23 19:33:02 +02:00
|
|
|
});
|
|
|
|
});
|
2021-07-16 16:41:58 +02:00
|
|
|
|
|
|
|
module.exports = {
|
2021-09-23 19:33:02 +02:00
|
|
|
entry: {
|
2021-10-03 17:11:32 +02:00
|
|
|
testing: './test/playground/context-loader.js',
|
2021-09-23 19:33:02 +02:00
|
|
|
},
|
2021-07-16 16:41:58 +02:00
|
|
|
output: {
|
2021-09-08 22:45:26 +02:00
|
|
|
path: path.resolve(__dirname, 'dist', 'tests'),
|
2021-10-03 17:11:32 +02:00
|
|
|
filename: 'context-loader.js',
|
2021-09-23 19:33:02 +02:00
|
|
|
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',
|
2021-07-16 16:41:58 +02:00
|
|
|
devtool: 'source-map',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
use: 'babel-loader',
|
2021-10-03 17:11:32 +02:00
|
|
|
test: /.js$/,
|
2021-07-16 16:41:58 +02:00
|
|
|
exclude: /node_modules/,
|
2021-10-03 17:11:32 +02:00
|
|
|
}
|
2021-07-16 16:41:58 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
2021-10-03 17:11:32 +02:00
|
|
|
extensions: ['.js','.json'],
|
2021-07-16 16:41:58 +02:00
|
|
|
},
|
2021-09-23 19:33:02 +02:00
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
2021-10-03 02:57:29 +02:00
|
|
|
new HtmlWebpackPlugin({ template: 'test/playground/index.html' }),
|
2021-09-23 19:33:02 +02:00
|
|
|
].concat(multiHtmlPlugin),
|
2021-07-16 16:41:58 +02:00
|
|
|
};
|