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

61 lines
1.3 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}`,
2021-10-03 02:57:29 +02:00
template: `test/playground/${name}.html`,
});
});
2021-07-16 16:41:58 +02:00
module.exports = {
entry: {
testing: './test/playground/context-loader.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: 'context-loader.js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
port: 8080,
open: true,
2021-07-16 16:41:58 +02:00
},
mode: 'development',
2021-07-16 16:41:58 +02:00
devtool: 'source-map',
module: {
rules: [
{
use: 'babel-loader',
test: /.js$/,
2021-07-16 16:41:58 +02:00
exclude: /node_modules/,
}
2021-07-16 16:41:58 +02:00
],
},
resolve: {
extensions: ['.js','.json'],
2021-07-16 16:41:58 +02:00
},
plugins: [
new CleanWebpackPlugin(),
2021-10-03 02:57:29 +02:00
new HtmlWebpackPlugin({ template: 'test/playground/index.html' }),
].concat(multiHtmlPlugin),
2021-07-16 16:41:58 +02:00
};