Skip to content

Commit

Permalink
Lint webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Feb 24, 2025
1 parent 507f86c commit 7a599f5
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions packages/simpleserialize.com/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const webpack = require('webpack');
const { resolve } = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require("webpack");
const {resolve} = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");

const isProd = process.env.NODE_ENV === 'production';
const isProd = process.env.NODE_ENV === "production";

const config = {
devtool: "source-map",
mode: isProd ? 'production' : 'development',
mode: isProd ? "production" : "development",
entry: {
index: './src/index.tsx',
index: "./src/index.tsx",
},
output: {
path: resolve(__dirname, 'dist'),
filename: '[name].js',
path: resolve(__dirname, "dist"),
filename: "[name].js",
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
module: {
rules: [
Expand All @@ -27,68 +27,68 @@ const config = {
},
},
{
test: /\.scss$/,
use: [
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader'
loader: "css-loader",
},
{
loader: 'sass-loader',
loader: "sass-loader",
options: {
sourceMap: true,
}
}
]
},{
},
},
],
},
{
test: /\.tsx?$/,
use: 'babel-loader',
use: "babel-loader",
exclude: /node_modules/,
}
},
],
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
new MiniCssExtractPlugin({
filename: 'css/[name].bundle.css'
filename: "css/[name].bundle.css",
}),
new HtmlWebpackPlugin({
title: 'Simple Serialize | Chainsafe Systems',
template: 'src/index.html',
title: "Simple Serialize | Chainsafe Systems",
template: "src/index.html",
}),
],
};

if (isProd) {
config.optimization = {
minimizer: [
],
minimizer: [],
};
} else {
config.devServer = {
port: 8080, // https://webpack.js.org/configuration/dev-server/#devserverport
open: true, // https://webpack.js.org/configuration/dev-server/#devserveropen
hot: true, // https://webpack.js.org/configuration/dev-server/#devserverhot
compress: true, // https://webpack.js.org/configuration/dev-server/#devservercompress
stats: 'errors-only', // https://webpack.js.org/configuration/dev-server/#devserverstats-
stats: "errors-only", // https://webpack.js.org/configuration/dev-server/#devserverstats-
overlay: true, // https://webpack.js.org/configuration/dev-server/#devserveroverlay
};
}

const workerConfig = {
name: "worker",
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
entry: {
index: './src/components/worker/index.ts',
index: "./src/components/worker/index.ts",
},
output: {
path: resolve(__dirname, 'dist'),
filename: 'worker.js',
path: resolve(__dirname, "dist"),
filename: "worker.js",
},
module: {
rules: [
Expand All @@ -100,21 +100,21 @@ const workerConfig = {
},
{
test: /worker?$/,
loader: 'threads-webpack-plugin',
loader: "threads-webpack-plugin",
},
{
test: /\.ts?$/,
use: 'babel-loader',
use: "babel-loader",
exclude: /node_modules/,
}
},
],
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
]
}
],
};

module.exports = [config, workerConfig];

0 comments on commit 7a599f5

Please sign in to comment.