You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me about a day to get this running on typescript as well. I guess commonjs is on the way out for everything.
Minimal steps to make it work.
In package.json include "type": "module".
In tsconfig.json ensure under compilerOptions you have "module": "es6" or whatever ES target you want. It will not work with a commonjs module setting.
Can you please provide a full working example of how to use the library in NodeJS?
I do not succeed in loading the library.
I always get errors such as
or
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
This is my
tsconfig.json
:I tried to add and remove the
type = "module"
line in package.json.I tried
let PushBullet = require('pushbullet');
or
import {PushBullet} from 'pushbullet';
or
import {PushBullet} from '../node_modules/pushbullet/lib/pushbullet.js';
All without luck...
Please provide a working example with tsconfig.json and package.json included.
I am working on Windows 10, Node 14.0.3, npm 6.14.5.
Many thanks!
The text was updated successfully, but these errors were encountered: