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

130 lines
3.4 KiB
JavaScript
Raw Permalink 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');
2021-12-12 23:28:32 +01:00
const CopyPlugin = require('copy-webpack-plugin');
2021-07-16 16:41:58 +02:00
module.exports = {
entry: {
2021-12-05 00:39:20 +01:00
arrow: './test/playground/arrow.js',
curvedLine: './test/playground/curvedLine.js',
events: './test/playground/events.js',
font: './test/playground/font.js',
rect: './test/playground/rect.js',
line: './test/playground/line.js',
workspace: './test/playground/workspace.js',
polyLine: './test/playground/polyLine.js',
shapes: './test/playground/shapes.js',
group: './test/playground/group.js',
prototype: './test/playground/prototype.js',
2021-12-12 23:28:32 +01:00
text: './test/playground/text.js',
image: './test/playground/image.js',
},
output: {
2022-01-26 20:25:11 +01:00
path: path.resolve(__dirname, 'test/playground/dist'),
filename: '[name].js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
port: 8080,
open: false,
},
mode: 'development',
devtool: 'source-map',
module: {
rules: [
{
use: 'babel-loader',
test: /.js$/,
2022-01-26 20:25:11 +01:00
exclude: [/node_modules/],
},
{
test: /\.(png|svg)$/i,
type: 'asset/inline',
},
],
},
resolve: {
alias: {
'@libraries': path.resolve(__dirname, '../../libraries/'),
2021-07-16 16:41:58 +02:00
},
extensions: ['.js', '.json'],
},
plugins: [
new CleanWebpackPlugin(),
2021-12-12 23:28:32 +01:00
new CopyPlugin({
2022-01-26 20:25:11 +01:00
patterns: [{ from: 'test/playground/styles.css', to: 'styles.css' }],
}),
new HtmlWebpackPlugin({
chunks: ['index'],
filename: 'index.html',
template: 'test/playground/index.html',
}),
new HtmlWebpackPlugin({
chunks: ['arrow'],
filename: 'arrow.html',
template: 'test/playground/arrow.html',
}),
new HtmlWebpackPlugin({
chunks: ['curvedLine'],
filename: 'curvedLine.html',
template: 'test/playground/curvedLine.html',
}),
new HtmlWebpackPlugin({
chunks: ['events'],
filename: 'events.html',
template: 'test/playground/events.html',
}),
new HtmlWebpackPlugin({
chunks: ['font'],
filename: 'font.html',
template: 'test/playground/font.html',
}),
new HtmlWebpackPlugin({
chunks: ['rect'],
filename: 'rect.html',
template: 'test/playground/rect.html',
}),
new HtmlWebpackPlugin({
chunks: ['line'],
filename: 'line.html',
template: 'test/playground/line.html',
}),
new HtmlWebpackPlugin({
chunks: ['workspace'],
filename: 'workspace.html',
template: 'test/playground/workspace.html',
}),
new HtmlWebpackPlugin({
chunks: ['polyLine'],
filename: 'polyLine.html',
template: 'test/playground/polyLine.html',
}),
new HtmlWebpackPlugin({
chunks: ['shapes'],
filename: 'shapes.html',
template: 'test/playground/shapes.html',
}),
new HtmlWebpackPlugin({
chunks: ['group'],
filename: 'group.html',
template: 'test/playground/group.html',
}),
new HtmlWebpackPlugin({
chunks: ['prototype'],
filename: 'prototype.html',
template: 'test/playground/prototype.html',
}),
new HtmlWebpackPlugin({
chunks: ['text'],
filename: 'text.html',
template: 'test/playground/text.html',
}),
new HtmlWebpackPlugin({
chunks: ['image'],
filename: 'image.html',
template: 'test/playground/image.html',
2021-12-12 23:28:32 +01:00
}),
2021-12-05 00:39:20 +01:00
],
2021-07-16 16:41:58 +02:00
};