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

Doesn't work with typescript #86

Closed
wimurk opened this issue Mar 9, 2022 · 4 comments
Closed

Doesn't work with typescript #86

wimurk opened this issue Mar 9, 2022 · 4 comments

Comments

@wimurk
Copy link

wimurk commented Mar 9, 2022

I use the framework AdonisJS which is build in typescript.
When i try to include the package it gives me the following error:

 require() of ES Module ......\node_modules\clipboardy\index.js from .......app\Controllers\Http\RobotsController.ts not supported.
Instead change the require of index.js in .....app\Controllers\Http\RobotsController.ts to a dynamic import() which is available in all CommonJS modules.

 at Object.<anonymous> ......app/Controllers/Http/RobotsController.ts:9
   4|   import axios from 'axios';
   5|   import https from 'https';
   6|   import robot from 'robotjs';
   7|   import {keyboard, Key} from '@nut-tree/nut-js';
   8|   import execa from 'execa';
>  9|   import clipboard from 'clipboardy';
@sindresorhus
Copy link
Owner

@wimurk
Copy link
Author

wimurk commented Mar 9, 2022

How is this closed? It doesn't work. THe link is outdated. i use the es2022

I tried all the options below

  const clipboard = import('clipboardy'); //error
  import * as clipboard from 'clipboardy' //error
```

All give the same error

@wimurk
Copy link
Author

wimurk commented Mar 9, 2022

I downgraded back to 2.3.0 and now it works.

@gladykov
Copy link

    Details:

.../node_modules/clipboardy/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import process from 'node:process';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

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

No branches or pull requests

3 participants