Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / webpack.config.js
blobc61c2c43bf91700ff9411f867340cbc5a19e867c
1 const path = require("path");
2 const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4 module.exports = {
5     mode: "production",
6     entry: {
7         main: "./web/htdocs/js/index.js",
8         mobile: "./web/htdocs/js/mobile.js",
9         side: "./web/htdocs/js/side_index.js"
10     },
11     output: {
12         path: path.resolve(__dirname, "web/htdocs/js"),
13         filename: "[name]_min.js",
14         publicPath: "js",
15         // Keep this until we have cleaned up our JS files to work as modules and changed all call sites
16         // from HTML code to work with the modules. Until then we need to keep the old behaviour of loading
17         // all JS code in the global namespace
18         libraryTarget: "window",
19         libraryExport: "default"
20     },
21     resolve: {
22         modules: [
23             "node_modules",
24             path.resolve(__dirname, "web/htdocs/js/modules"),
25             path.resolve(__dirname, "enterprise/web/htdocs/js/modules")
26         ]
27     },
28     module: {
29         rules: [
30             {
31                 test: /\.js$/,
32                 exclude: /node_modules/,
33                 use: {
34                     loader: "babel-loader",
35                     options: {
36                         presets: ["@babel/preset-env"]
37                     }
38                 }
39             },
40             {
41                 test: /\.css$/,
42                 use: [
43                     {
44                         loader: MiniCssExtractPlugin.loader,
45                         options: {
46                             //publicPath: "../../"
47                         }
48                     },
49                     "css-loader"
50                 ]
51             }
52         ]
53     },
54     plugins: [
55         new MiniCssExtractPlugin({
56             filename: "../[name]_min.css",
57         })
58     ]