in pre-es6:
var stream = require("./models/stream");
var stream = require("./routes/stream");
It works fine.
In es6:
import stream from './models/stream';
import stream from './routes/stream';
Error:
TypeError: /var/www/.../es6/app.js: Duplicate declaration "stream"
> 31 | import stream from './routes/stream';
Any ideas how can I import it properly?
You are re-declaring the stream
variable and never use it, so you can just import first file without assignment:
import './models/stream';
import stream from './routes/stream';