1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Make webpack configuration support scss, fonts and images

Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
Iku-turso 2023-03-20 13:42:11 +02:00
parent 6cd9be5ffe
commit a6ef3ef80e
2 changed files with 36 additions and 0 deletions

View File

@ -27,8 +27,10 @@
"css-loader": "^6.7.2", "css-loader": "^6.7.2",
"fork-ts-checker-webpack-plugin": "^7.3.0", "fork-ts-checker-webpack-plugin": "^7.3.0",
"mini-css-extract-plugin": "^2.7.3", "mini-css-extract-plugin": "^2.7.3",
"sass": "^1.58.2",
"sass-loader": "^13.2.0", "sass-loader": "^13.2.0",
"style-loader": "^3.3.1", "style-loader": "^3.3.1",
"tailwindcss": "^3.2.4",
"ts-loader": "^9.4.1", "ts-loader": "^9.4.1",
"webpack": "^5.76.0", "webpack": "^5.76.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",

View File

@ -1,5 +1,9 @@
const getNodeConfig = require("./get-node-config"); const getNodeConfig = require("./get-node-config");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");
// hack: hard-coded
const sassCommonVars = "/Users/maspiala/work/lens/packages/core/src/renderer";
module.exports = module.exports =
({ miniCssExtractPluginLoader = MiniCssExtractPlugin.loader } = {}) => ({ miniCssExtractPluginLoader = MiniCssExtractPlugin.loader } = {}) =>
@ -46,14 +50,44 @@ module.exports =
}, },
}, },
{
loader: "postcss-loader",
options: {
sourceMap: false,
postcssOptions: {
plugins: ["tailwindcss"],
},
},
},
{ {
loader: "sass-loader", loader: "sass-loader",
options: { options: {
sourceMap: false, sourceMap: false,
additionalData: `@import "${path.basename(sassCommonVars)}";`,
sassOptions: {
includePaths: [path.dirname(sassCommonVars)],
},
}, },
}, },
], ],
}, },
{
test: /\.(ttf|eot|woff2?)$/,
type: "asset/resource",
},
{
test: /\.svg$/,
type: "asset/source", // exports the source code of the asset, so we get XML
},
{
test: /\.(jpg|png|ico)$/,
type: "asset/resource", // path to file, e.g. "/static/build/assets/*"
},
], ],
}, },
}; };