2021-09-07 22:31:46 +02:00
|
|
|
const path = require('path');
|
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2021-09-23 22:51:24 +02:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2021-12-02 01:41:56 +01:00
|
|
|
const CopyPlugin = require('copy-webpack-plugin');
|
2021-09-07 22:31:46 +02:00
|
|
|
|
|
|
|
/** @type {import('webpack').Configuration} */
|
|
|
|
module.exports = {
|
2021-10-05 02:38:11 +02:00
|
|
|
entry: {
|
2021-12-02 01:41:56 +01:00
|
|
|
layout: path.resolve(__dirname, './test/playground/layout/context-loader'),
|
2021-12-13 22:30:37 +01:00
|
|
|
viewmode: path.resolve(__dirname, './test/playground/map-render/js/viewmode'),
|
|
|
|
embedded: path.resolve(__dirname, './test/playground/map-render/js/embedded'),
|
2021-12-05 18:25:16 +01:00
|
|
|
editor: path.resolve(__dirname, './test/playground/map-render/js/editor'),
|
2021-10-05 02:38:11 +02:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'dist', 'test'),
|
|
|
|
filename: '[name].test.js',
|
|
|
|
publicPath: '',
|
|
|
|
},
|
2021-12-02 01:41:56 +01:00
|
|
|
devServer: {
|
|
|
|
historyApiFallback: true,
|
|
|
|
port: 8081,
|
|
|
|
open: false,
|
|
|
|
},
|
2021-10-05 02:38:11 +02:00
|
|
|
mode: 'production',
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all',
|
|
|
|
minSize: 2000000,
|
2021-09-08 22:45:26 +02:00
|
|
|
},
|
2021-10-05 02:38:11 +02:00
|
|
|
},
|
|
|
|
devtool: 'source-map',
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
use: 'babel-loader',
|
|
|
|
test: /.js$/,
|
2021-12-02 01:41:56 +01:00
|
|
|
exclude: [
|
|
|
|
/node_modules/,
|
|
|
|
path.resolve(__dirname, '../../libraries/mootools-core-1.4.5'),
|
2021-12-13 22:30:37 +01:00
|
|
|
path.resolve(__dirname, '../../libraries/underscore-min'),
|
2021-12-05 18:25:16 +01:00
|
|
|
/lib\/raphael/ig,
|
2021-12-02 01:41:56 +01:00
|
|
|
],
|
2021-10-05 02:38:11 +02:00
|
|
|
},
|
2021-12-13 22:30:37 +01:00
|
|
|
{
|
|
|
|
test: /\.less$/i,
|
|
|
|
use: [
|
|
|
|
// compiles Less to CSS
|
|
|
|
'style-loader',
|
|
|
|
'css-loader?url=false',
|
|
|
|
'less-loader',
|
|
|
|
],
|
|
|
|
},
|
2021-09-23 22:51:24 +02:00
|
|
|
],
|
2021-10-05 02:38:11 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
2021-12-02 01:41:56 +01:00
|
|
|
alias: {
|
|
|
|
'@libraries': path.resolve(__dirname, '../../libraries/'),
|
2021-12-05 00:39:20 +01:00
|
|
|
|
2021-12-02 01:41:56 +01:00
|
|
|
},
|
2021-10-05 02:38:11 +02:00
|
|
|
extensions: ['.js', '.json'],
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
2021-12-02 01:41:56 +01:00
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{ from: 'test/playground/map-render/images/favicon.ico', to: 'favicon.ico' },
|
|
|
|
{ from: 'test/playground/map-render/images', to: 'images' },
|
|
|
|
{ from: 'test/playground/map-render/icons', to: 'icons' },
|
2021-12-05 18:25:16 +01:00
|
|
|
{ from: 'test/playground/map-render/js', to: 'js' },
|
2021-12-02 01:41:56 +01:00
|
|
|
{ from: 'test/playground/map-render/samples', to: 'samples' },
|
2021-12-05 18:25:16 +01:00
|
|
|
{ from: 'test/playground/map-render/bootstrap', to: 'bootstrap' },
|
2021-12-02 01:41:56 +01:00
|
|
|
{ from: 'test/playground/index.html', to: 'index.html' },
|
2021-12-05 18:25:16 +01:00
|
|
|
{ from: 'test/playground/map-render/html/container.json', to: 'html/container.json' },
|
|
|
|
{ from: 'test/playground/map-render/html/container.html', to: 'container.html' },
|
2021-12-13 22:30:37 +01:00
|
|
|
{ from: 'test/playground/map-render/css/widget', to: 'css/widget' },
|
2021-12-02 01:41:56 +01:00
|
|
|
],
|
2021-10-05 02:38:11 +02:00
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
chunks: ['layout'],
|
2021-12-02 01:41:56 +01:00
|
|
|
filename: 'layout.html',
|
|
|
|
template: 'test/playground/layout/index.html',
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
2021-12-13 22:30:37 +01:00
|
|
|
chunks: ['viewmode'],
|
2021-12-02 01:41:56 +01:00
|
|
|
filename: 'viewmode.html',
|
|
|
|
template: 'test/playground/map-render/html/viewmode.html',
|
2021-10-05 02:38:11 +02:00
|
|
|
}),
|
2021-12-05 18:25:16 +01:00
|
|
|
new HtmlWebpackPlugin({
|
2021-12-13 22:30:37 +01:00
|
|
|
chunks: ['embedded'],
|
2021-12-05 18:25:16 +01:00
|
|
|
filename: 'embedded.html',
|
|
|
|
template: 'test/playground/map-render/html/embedded.html',
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
chunks: ['editor'],
|
|
|
|
filename: 'editor.html',
|
|
|
|
template: 'test/playground/map-render/html/editor.html',
|
|
|
|
}),
|
2021-10-05 02:38:11 +02:00
|
|
|
],
|
2021-09-07 22:31:46 +02:00
|
|
|
};
|