Kartik Thakur
Kartik Thakur

Reputation: 11

Unexpected character '�' . You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file

I am using react-electron to make desktop applications. I am using npm koffi package to enable dll safe mode. But while making using npm run package, I am getting the following issue: enter image description here

given below is my webpack.config.js file code:

const path = require('path');

module.exports = {
  target: 'electron-main',
  module: {
    rules: [
      // Rule for .xlsx files
      {
        test: /\.js$|jsx/,
        use: 'xlsx-loader',
      },
      // Rule for .node files
      {
        test: /\.node$/,
        use: {
          loader: 'node-loader',
        },
      },
    ],
  },
  resolve: {
    extensions: ['.js', '.json', '.node'], // Ensure .node files are resolved
  },
  externals: {
    // Exclude koffi and other native modules from being bundled
    koffi: 'commonjs koffi',
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
};

Upvotes: 0

Views: 36

Answers (0)

Related Questions