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

Publish vest module on npm #298

Closed
guyb7 opened this issue Aug 5, 2020 · 1 comment
Closed

Publish vest module on npm #298

guyb7 opened this issue Aug 5, 2020 · 1 comment

Comments

@guyb7
Copy link

guyb7 commented Aug 5, 2020

The version published in npm contains only the minified code intended for browsers, so the sample code in the docs doesn't work in node.

import vest, { test, enforce } from 'vest'
               ^^^^
SyntaxError: The requested module 'vest' does not provide an export named 'test'
@ealush
Copy link
Owner

ealush commented Aug 7, 2020

Hey @guyb7, thank you for opening this issue.

The thing with node's module system is that it is fragmented and there are many paths one could go.
In your specific case, you could replace your import statement with any of the following to make it work immediately:

import vest from 'vest';
const {test, enforce} = vest;

Or

const vest = require('vest');
const {test, enforce} = vest;

But, you do raise a valid point, and I am working on a change that will handle it in multiple fronts:

#299

  1. Update the docs, add a page on running vest in node.
  2. Add esm and cjs modules, up until now, only umd module existed.
  3. Add node-14 compatible package entries to auto-infer which module to use.

@ealush ealush closed this as completed Aug 9, 2020
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

2 participants