title: Is there a way to parcel a nodejs app which uses express and ejs?
body: <p>I am trying to parcel my nodejs app which uses epxress and ejs but I am getting a parcel error during the process</p>
  
  <p>My app already runs as expected if I use the standard way:
  <code>node app.js</code></p>
  
  <p>However, when I try to run it with parcel I am getting an error.</p>
  
  <p>my package.json (showing only relevant parts):</p>
  
  <pre><code>  "scripts": {
      "start": "parcel views/index.ejs",
      "build": "parcel build --public-url . views/index.ejs"
    },
    "dependencies": {
      "parcel-plugin-ejs": "^0.2.0",
      "parcel-plugin-ejs-template": "^0.1.1",
    },
    "devDependencies": {
      "parcel-bundler": "^1.12.3"
    }
  </code></pre>
  
  <p>this is how I am rendering the page:</p>
  
  <pre><code>router.get("/" , function(req, res) {
    (async () =&gt; {
      const client = await pool.connect()
      try {
        const result = await client.query('select id, name from mytable')
        res.render("index", {
          items: result.rows
        })
      } finally {
        client.release()
      }
    })().catch(e =&gt; console.error(e.stack))
  });
  </code></pre>
  
  <p>and my index.ejs file:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
  
    &lt;title&gt;My website&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div class="menu"&gt;
      &lt;% items.forEach(function(row){ %&gt;
      &lt;div class="item" data-value="&lt;%= row.id %&gt;"&gt; &lt;%= row.name %&gt;&lt;/div&gt;
              &lt;% }) %&gt;
  &lt;/div&gt;
  .
  .
  .
  .
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>I would expect my app to be be parceled successfully and to be able to access it through the url provided.</p>
  
  <p>However, I am getting this error:</p>
  
  <pre><code>$ npm run start
  
  &gt; my_project@1.0.0 start /home/user/my_project
  &gt; parcel views/index.ejs
  
  Server running at http://localhost:1234 
    /home/user/my_project/views/index.ejs: items is not defined
      at eval (eval at compile (/home/user/my_project/node_modules/ejs/lib/ejs.js:618:12), &lt;anonymous&gt;:5:8)
      at returnedFn (/home/user/my_project/node_modules/ejs/lib/ejs.js:653:17)
      at EjsAsset.generate (/home/user/my_project/node_modules/parcel-plugin-ejs-template/EjsAsset.js:30:12)
      at &lt;anonymous&gt;
  </code></pre>
  
  <p>Where items is just a list of products that I am sending from back-end with res.render() in order to create a drop-down.</p>
  
  <p>Any help would be appreciated.</p>