-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
webpack.config.js
56 lines (54 loc) · 1.49 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Webpack configuration for sphinx-book-theme
const { resolve } = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); // Compile our translation files
const { exec } = require("child_process");
exec("python src/quantecon_book_theme/_compile_translations.py");
// Paths for various assets (sources and destinations)
const staticPath = resolve(
__dirname,
"src/quantecon_book_theme/theme/quantecon_book_theme/static",
);
module.exports = {
mode: "production",
devtool: "source-map",
entry: {
"quantecon-book-theme": [
"./src/quantecon_book_theme/assets/scripts/index.js",
],
},
output: {
filename: "scripts/[name].js",
path: staticPath,
},
optimization: { minimizer: ["...", new CssMinimizerPlugin()] },
module: {
rules: [
{
test: /\.scss$/,
use: [
{ loader: MiniCssExtractPlugin.loader },
// Interprets `@import` and `url()` like `import/require()` and will resolve them
{
loader: "css-loader",
options: {
url: false,
},
},
{
// Loads a SASS/SCSS file and compiles it to CSS
loader: "sass-loader",
options: {
sassOptions: { outputStyle: "expanded" },
},
},
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "styles/[name].css",
}),
],
};