I just created a new application using the following command:
npx create-electron-app my-new-app --template=typescript-webpack
Inside the renderer.ts I added the following code
import "./index.css";
import { ipcRenderer } from "electron";
But when I run npm run start I have the following error in Browser Console
Uncaught ReferenceError: require is not defined
Update What I've tried:
webpack.plugins.js
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const webpack = require("webpack");
module.exports = [
new ForkTsCheckerWebpackPlugin(),
new webpack.ExternalsPlugin("commonjs", ["electron"]),
];
But it still doesn't work.