lektor-website/webpack/webpack.config.js

58 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-11-29 01:24:51 +01:00
var webpack = require("webpack");
var path = require("path");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
2015-12-19 14:52:17 +01:00
var options = {
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: {
2021-11-29 01:24:51 +01:00
path: path.dirname(__dirname) + "/assets/static",
filename: "[name].js",
2015-12-19 14:52:17 +01:00
},
2021-11-29 01:24:51 +01:00
devtool: "cheap-module-source-map",
mode: "production",
2015-12-19 14:52:17 +01:00
resolve: {
2021-11-29 01:24:51 +01:00
modules: ["node_modules"],
extensions: ["", ".js"],
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: {
presets: ["es2015"],
},
},
],
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)(\?.*?)?$/,
2021-11-29 01:24:51 +01:00
use: ["file"],
},
],
2015-12-19 14:52:17 +01:00
},
plugins: [
new webpack.ProvidePlugin({
2021-11-29 01:24:51 +01:00
$: "jquery",
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;