When I try to use the stability-ts module in my project, I get the following error:
import { generate } from 'stability-ts';
^^^^^^^^
SyntaxError: Named export 'generate' not found. The requested module 'stability-ts' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'stability-ts';
const { generate } = pkg;
Ah! No problem. After all, my package.json type value is module. After changing the code to this:
import stability from 'stability-ts';
const { generate } = stability;
I get the following error:
TypeError: generate is not a function
at file:///usr/src/app/src/index.js:23:17
at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/app/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/usr/src/app/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
at /usr/src/app/node_modules/express/lib/router/index.js:284:15
at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:346:12)
at next (/usr/src/app/node_modules/express/lib/router/index.js:280:10)
at jsonParser (/usr/src/app/node_modules/body-parser/lib/types/json.js:110:7)
at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
When I console.log(stability) I get empty object. {}. I'm not sure if I'm missing anything else.
When I try to use the
stability-ts
module in my project, I get the following error:Ah! No problem. After all, my package.json type value is
module
. After changing the code to this:I get the following error:
When I
console.log(stability)
I get empty object. {}. I'm not sure if I'm missing anything else.