lektor-website/webpack/webpack.config.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-02-20 14:41:45 +01:00
const webpack = require("webpack");
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2015-12-19 14:52:17 +01:00
2022-02-20 14:41:45 +01:00
const options = {
2015-12-19 14:52:17 +01:00
entry: {
2021-11-29 01:24:51 +01:00
app: "./js/app.js",
styles: "./scss/main.scss",
2015-12-19 14:52:17 +01:00
},
output: {
2022-02-20 14:41:45 +01:00
path: path.join(__dirname, "..", "assets", "static"),
2021-11-29 01:24:51 +01:00
filename: "[name].js",
2015-12-19 14:52:17 +01:00
},
2022-02-20 14:41:45 +01:00
devtool: "source-map",
2021-11-29 01:24:51 +01:00
mode: "production",
2015-12-19 14:52:17 +01:00
module: {
2021-11-29 01:24:51 +01:00
rules: [
2015-12-19 14:52:17 +01:00
{
test: /\.js$/,
exclude: /node_modules/,
2021-11-29 01:24:51 +01:00
use: [
{
loader: "babel-loader",
options: {
2022-02-20 14:41:45 +01:00
presets: ["@babel/preset-env"],
2021-11-29 01:24:51 +01:00
},
},
],
2015-12-19 14:52:17 +01:00
},
{
test: /\.scss$/,
2021-11-29 01:24:51 +01:00
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
2015-12-19 14:52:17 +01:00
},
{
test: /\.css$/,
2021-11-29 01:24:51 +01:00
use: [MiniCssExtractPlugin.loader, "css-loader"],
2015-12-19 14:52:17 +01:00
},
{
test: /\.(woff2?|ttf|eot|svg|png)(\?.*?)?$/,
2022-02-20 14:41:45 +01:00
type: "asset",
2021-11-29 01:24:51 +01:00
},
],
2015-12-19 14:52:17 +01:00
},
plugins: [
new webpack.ProvidePlugin({
2021-11-29 01:24:51 +01:00
jQuery: "jquery",
2015-12-19 14:52:17 +01:00
}),
2021-11-29 01:24:51 +01:00
new MiniCssExtractPlugin(),
],
2015-12-19 14:52:17 +01:00
};
module.exports = options;