With Node 16.13.2 I am trying to add the validate module in an existing code base. Reading the 2 year old question I can't make it work with the below PoC. I get
import Schema from 'validate';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Question
Can anyone show me how the below PoC should look like for it to work?
index.js
const mod = require('./mod');
mod.js
import Schema from 'validate';
const test;
module.exports = test;