Answer the question
In order to leave comments, you need to log in
How to combine the ability to use import and require?
When trying to use import
, it gave an error that it is possible only in modules
Added a property to Jason
"type": "module"
Since then, it began to swear at require
How to combine them?
const express = require('express')
const app = express()
const port = 3300
import {currency} from './api/currency.js'
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Answer the question
In order to leave comments, you need to log in
https://www.npmjs.com/package/commonjs-variables-f...
made for myself, use it to your health
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question