我试图加载robotjs
,electron
但我不断收到一个恼人的Failed to compile
错误。
我正在使用Vue.js
界面,如果这很重要。
错误
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)
node-loader
我尝试使用to添加新规则,webpack
但没有奏效。
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()],
};