Hello everyone, Webpack Serve is not working after I switched to Linux mint. I've reinstalled the npm packages and also installed webpack directly over my console. My serve command is "serve": "webpack serve" Building the Webpack normally works.
This is my webpack config:
const path = require("path");
const Dotenv = require("dotenv-webpack");
require("dotenv").config();
const WorkboxWebpackPlugin = require("workbox-webpack-plugin");
const isProduction = process.env.NODE_ENV == "production";
const config = {
watch: true,
entry: "./src/frontend/index.ts",
output: {
path: path.resolve(__dirname, "dist"),
filename: "index.js",
},
devServer: {
// hot: "only",
hot: "only",
open: true,
static: {
directory: path.join(__dirname, "public"),
},
compress: true,
port: 9000,
host: "localhost",
},
plugins: [
new Dotenv({
path: `./.env`,
}),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/i,
loader: "ts-loader",
exclude: ["/node_modules/"],
},
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
type: "asset",
},
// Add your rules for custom modules here
// Learn more about loaders from https://webpack.js.org/loaders/
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
};
module.exports = () => {
if (isProduction) {
config.mode = "production";
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
} else {
config.mode = "development";
}
return config;
};