Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

require is not defined #96

Open
raphael10-collab opened this issue Jun 30, 2021 · 0 comments
Open

require is not defined #96

raphael10-collab opened this issue Jun 30, 2021 · 0 comments

Comments

@raphael10-collab
Copy link

raphael10-collab commented Jun 30, 2021

I'm trying to include node-simple-xmpp in my Electron-React-Webpack-Typescrip app.

In webpack.config.js I've added xmpp:

const xmpp = require("simple-xmpp");

    externals: [
      {
        'utf-8-validate': 'commonjs utf-8-validate',
        bufferutil: 'commonjs bufferutil',
      },
      {
        'xmpp': xmpp,
      }
    ],

But still I get require is not defined when adding these lines in a tsx file:

import xmpp from 'simple-xmpp';

xmpp.connect({
    jid: "",
    password: "",
    host: "",
    port: 5280
});
  • Electron: ^13.1.4
  • webpack: ^5.23.0
  • react: ^17.0.2
  • node: v14.17.0

How to resolve the problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant