]> git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.geo.js/webpack.common.js
GeoJSON HTTP service
[gpl/argeo-suite.git] / org.argeo.app.geo.js / webpack.common.js
1 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
2 const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
3 const HtmlWebpackPlugin = require('html-webpack-plugin');
4 const path = require('path');
5
6 module.exports = {
7 entry: {
8 index: './src/org.argeo.app.geo.js/index.js'
9 },
10 output: {
11 filename: '[name].[contenthash].js',
12 path: path.resolve(__dirname, 'org/argeo/app/geo/js'),
13 clean: true,
14 },
15 optimization: {
16 moduleIds: 'deterministic',
17 runtimeChunk: 'single',
18 // split code
19 splitChunks: {
20 chunks: 'all',
21 },
22 minimizer: [
23 // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
24 `...`,
25 new CssMinimizerPlugin(),
26 ],
27 },
28 module: {
29 rules: [
30 {
31 test: /\.(css)$/,
32 use: [
33 MiniCssExtractPlugin.loader,
34 'css-loader',
35 ],
36 },
37 ],
38 },
39 plugins: [
40 // deal with CSS
41 new MiniCssExtractPlugin(),
42 // deal with HTML generation
43 new HtmlWebpackPlugin({
44 title: 'Open Layers',
45 template: 'src/org.argeo.app.geo.js/index.html',
46 scriptLoading: 'module',
47 }),
48
49 ],
50 };