0

I tried importing modules but they were not found

const express = require('express');
const app = express();
const view = __dirname + '/view/';
app.get('/', function (req, res) {
  res.sendFile(path.join(view + 'home.html'));
});
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
  </head>
  <body>
    <h1>ok</h1>
  </body>
  <script>
    import data from 'input-plugin-date';
  </script>
</html>

enter image description here how do I import plugins or anything on the express router because I need them

  • Does this answer your question? [Which browsers support import and export syntax for ECMAScript 6?](https://stackoverflow.com/questions/33516906/which-browsers-support-import-and-export-syntax-for-ecmascript-6) – Jeremy Thille May 25 '20 at 15:14
  • ...but you're importing an NPM module in the browser, this has nothing to do with Express (which operates on the server) – Jeremy Thille May 25 '20 at 15:15
  • you need to import from the path, suppose `import from '__module-path__'` – Sifat Haque May 25 '20 at 15:16

0 Answers0