I think the problem of
Model creation error: SyntaxError: Unexpected token ':'
comes from the file-name.js.map
that are produced by Typescript in the /model
folder.
I added a condition in the function that filters the model files in the index.ts
to avoid those files:
fs.readdirSync(modelsDir)
.filter(file => file.indexOf('.') !== 0 && file !== 'index.js' && !file.includes('.map'))
...