After developing a module, I decided to move it out of the app and into node_modules. However, I encountered an error
error TS2307: Cannot find module 'bipartite-graph'.
. In this case, bipartite-graph
is actually my own module.
Here is the content of my systemjs.config.ts
:
SystemJS.config({
packages: {
app: {
main: './app.js',
defaultExtension: 'js'
},
'bipartite-graph': {
main: './bipartite-graph.js',
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
}
},
map: {
app: 'app',
'rxjs': 'node_modules/rxjs',
'bipartite-graph': 'app/bipartite-graph'
}
});
And now, looking at the app.ts
:
import { Subject } from 'rxjs/Subject';
import BipartiteGraph from 'bipartite-graph';
let subject: Subject<boolean> = new Subject<boolean>();
let bg = new BipartiteGraph([35, 50, 40], [45, 20, 30, 30], [[8, 6, 10, 9], [9, 12, 13, 7], [14, 9, 16, 5]]);
const n = 3, m = 4;
let i = 1, j = 1;
while (i <= n && j <= m) {
bg.setAmount(i, j, Math.min(bg.getCapacity(i), bg.getDemand(j)));
bg.setCapacity(i, bg.getCapacity(i) - bg.getAmount(i, j)); bg.setDemand(j, bg.getDemand(j) - bg.getAmount(i, j));
if (bg.getCapacity(i) === 0) {
i = i + 1;
} else {
j = j + 1;
}
}
bg.draw();
The transpilation of the project was successful and the final app works without any issues. However, both Webstorm and tsc are throwing errors. Even importing rxjs
didn't reveal any crucial differences. What could be the missing piece here? I attempted moving the module to node_modules
and adjusting the path in systemjs.config.ts
, but unfortunately, it did not resolve the problem. You can access the entire project on GitHub.