Reputation: 1135
I have a working nodejs projectA written in typescript. I generate a distribution with webpack, main entry point is dist/index.js. I link with
npm link
Now, in projectB, I link the projects:
npm link projectA
In projectB source code, I can import classes from projects:
import {someClass} from 'projectA'
VisualStudio seems to recognize it. I compile it and I run the server on projectB.
But it crashes with
ReferenceError: window is not defined
The culprit is projectA/dist/index.js
What am I doing wrong?
PS. I'm using last node/typescript versions
Upvotes: 0
Views: 131
Reputation: 99523
The error suggests that the library you are using is made for browsers (where window
exists) and node Node.js (where it doesn't).
Upvotes: 1