Im trying to load robotjs
with electron
but I keep getting an annoying Failed to compile
error.
I'm using Vue.js
for the interface, if that matters.
The error
error in ./node_modules/robotjs/build/Release/robotjs.node
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
I tried adding a new rule using node-loader
to webpack
but that didn't work.
import MiniCssExtractPlugin from "mini-css-extract-plugin";
module.exports = {
mode: "development",
devtool: "source-map",
target: "node",
node: {
__dirname: false,
},
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.node$/,
loader: "node-loader",
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: {
loader: "ts-loader",
},
},
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
},
],
},
plugins: [new MiniCssExtractPlugin()],
};