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

72 lines
1.6 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) => new HtmlWebpackPlugin({
chunks: ['testing'],
filename: `${name}.html`,
template: `test/playground/${name}.html`,
}),
);
2021-07-16 16:41:58 +02:00
module.exports = {
entry: {
testing: './test/playground/context-loader.js',
jquery: '../../libraries/jquery-2.1.0',
},
output: {
path: path.resolve(__dirname, 'dist', 'tests'),
filename: '[name].js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
port: 8080,
open: false,
},
mode: 'development',
devtool: 'source-map',
module: {
rules: [
{
use: 'babel-loader',
test: /.js$/,
exclude: [
/node_modules/,
path.resolve(__dirname, '../../libraries/mootools-core-1.4.5'),
path.resolve(__dirname, '../../libraries/underscore-min'),
2021-07-16 16:41:58 +02:00
],
},
],
},
resolve: {
alias: {
'@libraries': path.resolve(__dirname, '../../libraries/'),
'@svg': path.resolve(__dirname, './src/components/peer/svg/'),
'@utils': path.resolve(__dirname, './src/components/peer/utils/'),
'@components': path.resolve(__dirname, './src/components/'),
2021-07-16 16:41:58 +02:00
},
extensions: ['.js', '.json'],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ template: 'test/playground/index.html' }),
].concat(multiHtmlPlugin),
2021-07-16 16:41:58 +02:00
};