Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Cannot use import statement outside a module #1038

Open
CamilleDrapier opened this issue Dec 27, 2024 · 1 comment
Open

SyntaxError: Cannot use import statement outside a module #1038

CamilleDrapier opened this issue Dec 27, 2024 · 1 comment

Comments

@CamilleDrapier
Copy link

Describe the bug

After updating "@xmpp/resolve" from 0.13.1 to 0.13.3, some import started failing.

Logs

    import http from 'node:http';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

       8 | import _middleware from '@xmpp/middleware';
       9 | import _reconnect from '@xmpp/reconnect';
    > 10 | import _resolve from '@xmpp/resolve';
         | ^
      11 | import _resourceBinding from '@xmpp/resource-binding';
      12 | import _sasl from '@xmpp/sasl';
      13 | import plain from '@xmpp/sasl-plain';

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1496:14)
      at Object.<anonymous> (node_modules/@xmpp/resolve/lib/http.js:4:35)
      at Object.<anonymous> (node_modules/@xmpp/resolve/resolve.js:4:14)
      at Object.<anonymous> (node_modules/@xmpp/resolve/index.js:3:17)
      at Object.<anonymous> (src/workers/comms/xmpp.ts:10:1)
      at Object.<anonymous> (src/workers/comms/worker.ts:4:1)
      at Object.<anonymous> (src/workers/comms/index.ts:10:1)
      at Object.<anonymous> (src/api/oauth.ts:8:1)
      at Object.<anonymous> (src/api/oauth.jest.spec.ts:3:1)

Environment

Operating System - Darwin(24.2.0) - darwin/arm64
NodeJs - 20.18.1
NPM - 10.8.2

Maybe it is a similar problem as to #1031 ?

@sonnyp
Copy link
Member

sonnyp commented Dec 28, 2024

As you can see here https://www.npmjs.com/package/@xmpp/resolve/v/0.13.3?activeTab=code @xmpp/resolve 0.13.3 doesn't use import so something must be wrong with your setup.

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

No branches or pull requests

2 participants