1 const path = require("path");
2 const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");
3 const webpack = require("webpack");
8 main: "./web/htdocs/js/index.js",
9 mobile: "./web/htdocs/js/mobile.js",
10 side: "./web/htdocs/js/side_index.js",
12 "./web/htdocs/themes/facelift/theme.scss",
13 "./web/htdocs/themes/classic/theme.scss",
17 path: path.resolve(__dirname, "web/htdocs/js"),
18 filename: "[name]_min.js",
20 // Keep this until we have cleaned up our JS files to work as modules and changed all call sites
21 // from HTML code to work with the modules. Until then we need to keep the old behaviour of loading
22 // all JS code in the global namespace
23 libraryTarget: "window",
24 libraryExport: "default"
29 path.resolve(__dirname, "web/htdocs/js/modules"),
30 path.resolve(__dirname, "enterprise/web/htdocs/js/modules")
37 exclude: /node_modules/,
39 loader: "babel-loader",
41 presets: ["@babel/preset-env"]
46 // needed for theme CSS files
50 // 5. Write to theme specific file
52 loader: "file-loader",
54 regExp: /\/([a-z0-9_-]+)\/([a-z0-9_-]+)\.scss$/,
55 name: "../themes/[1]/[2].css"
58 // 4. Extract CSS definitions from JS wrapped CSS
60 loader: "extract-loader"
62 // 3. Interpret and resolve @import / url()
70 // 2. Some postprocessing of CSS definitions (see postcss.config.js)
71 // - add browser vendor prefixes https://github.com/postcss/autoprefixer
72 // - minifies CSS with https://github.com/jakubpawlowicz/clean-css
74 loader: "postcss-loader"
76 // 1. Transform sass definitions into CSS
78 loader: "sass-loader",
80 // Hand over build options from webpack to SASS
81 data: "$ENTERPRISE: " + process.env.ENTERPRISE + ";\n"
82 + "$MANAGED: " + process.env.MANAGED + ";",
83 "includePaths": ["node_modules"],
84 // See https://github.com/sass/node-sass/blob/master/README.md#options
85 outputStyle: "expanded",
94 new FixStyleOnlyEntriesPlugin(),
95 new webpack.EnvironmentPlugin(["ENTERPRISE", "MANAGED"]),