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
This is issue for version 5 (dev).
I currently use node-input-validator version next (v5). I love this next version, cannot wait for the stable release 😃 .
And the problem begin when I use it on esmodule.
This is the error throw when I import it from esmodule
import { extend, Messages, Validator } from 'node-input-validator';
^^^^^^
SyntaxError: The requested module 'node-input-validator' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'node-input-validator';
const { extend, Messages, Validator } = pkg;
Currently when I import node-input-validator, it still import the cjs version.
The fix is just add additional config "exports" in package.json
example
Thanks for the information, will add soon. FYI: Currently, I 'm working on nested inputs logic, will rollout new release soon. Stable version soon after this.
This is issue for version 5 (dev).
I currently use node-input-validator version next (v5). I love this next version, cannot wait for the stable release 😃 .
And the problem begin when I use it on esmodule.
This is the error throw when I import it from esmodule
Currently when I import node-input-validator, it still import the cjs version.
The fix is just add additional config "exports" in package.json
example
Also you must add additional package.json on each folder with this bash script
You can read more here how to make hybrid nodejs package
For now, I am still use the cjs version and import it with
@rollup/plugin-commonjs
The text was updated successfully, but these errors were encountered: