aux-search/frontend/config/webpack.common.js
github-actions[bot] 84ce7fdf52
Update npm dependencies (also flake.lock: Update) (#532)
* flake.lock: Update

Flake lock file updates:

• Updated input 'flake-utils':
    'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07)
  → 'github:numtide/flake-utils/6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817' (2022-10-29)
• Updated input 'nixos-org-configurations':
    'github:NixOS/nixos-org-configurations/569797100aac69780a12542c2143bb741380d4ec' (2022-08-17)
  → 'github:NixOS/nixos-org-configurations/cebfd15c30724cadacf85b5fd950dc1070c4eb7d' (2022-10-26)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f3d0897be466aa09a37f6bf59e62c360c3f9a6cc' (2022-08-25)
  → 'github:NixOS/nixpkgs/448a599c49978c2794401bfc3a2e1fba1a8663be' (2022-10-28)

* Switch from yarn to npm for frontend

also update all the npm dependencies

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rok Garbas <rok@garbas.si>
2022-11-03 22:26:58 +01:00

79 lines
2.5 KiB
JavaScript

const path = require('path');
const webpack = require("webpack");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
module.exports = (withDebug) => {
return {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, '../dist'),
filename: 'bundle.js'
},
resolve: {
modules: [path.join(__dirname, "../src"), 'node_modules'],
extensions: [".elm", ".js"]
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.html"
}),
new CleanWebpackPlugin(),
new webpack.EnvironmentPlugin([
"ELASTICSEARCH_MAPPING_SCHEMA_VERSION",
"NIXOS_CHANNELS"
]),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env)
}),
],
optimization: {
// Prevents compilation errors causing the hot loader to lose state
emitOnErrors: false
},
module: {
rules: [
{
test: /\.elm$/,
use: [
{loader: "elm-reloader"},
{
loader: "elm-webpack-loader",
options: {
// add Elm's debug overlay to output
debug: withDebug,
optimize: false
}
}
]
}, {
test: /\.(sa|sc|c)ss$/i,
use: ['style-loader', 'css-loader', {
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [
require("autoprefixer"),
],
},
}
}, "sass-loader"],
}, {
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
],
}
};
};