Parcel: Parcel 2: Package Manager API

Created on 25 Oct 2019  ยท  2Comments  ยท  Source: parcel-bundler/parcel

โ” Question

Hello, as i'm using Parcel to make a testing tool, i was wondering if i could use the Package Manager that Parcel has, to install 'optional' dependencies on the fly when actually used.
Though i'm not sure how to use this package or if it's even possible to use it outside of Parcel ?

Could someone point me towards how to use it or tell me if it's not possible to do so.

Thanks :)

Waiting Question

All 2 comments

An example:

import {NodePackageManager} from '@parcel/package-manager';
import {NodeFS} from '@parcel/fs';

let packageManager = new NodePackageManager(new NodeFS());
let defaultConfig = await packageManager.require( // or .resolve
  '@parcel/config-default', // package specifier
  __filename // resolve from which file (not folder!)
);

Thanks, work like a charm ๐Ÿ‘

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidnagli picture davidnagli  ยท  3Comments

dsky1990 picture dsky1990  ยท  3Comments

oliger picture oliger  ยท  3Comments

jzimmek picture jzimmek  ยท  3Comments

medhatdawoud picture medhatdawoud  ยท  3Comments