#StackBounty: #node.js #express #ejs #parceljs Is there a way to parcel a nodejs app which uses express and ejs?

Bounty: 100

I am trying to parcel my nodejs app which uses epxress and ejs but I am getting a parcel error during the process

My app already runs as expected if I use the standard way:
node app.js

However, when I try to run it with parcel I am getting an error.

my package.json (showing only relevant parts):

  "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"
  }

I would expect my app to be be parceled successfully and to be able to access it through the url provided.

However, I am getting this error:

$ npm run start

> my_project@1.0.0 start /home/user/my_project
> parcel views/index.ejs

Server running at http://localhost:1234 
🚨  /home/user/my_project/views/index.ejs: item is not defined
    at eval (eval at compile (/home/user/my_project/node_modules/ejs/lib/ejs.js:618:12), <anonymous>: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 <anonymous>

Where item is just a list of products that I am sending from back-end with res.render() in order to create a drop-down.

Any help would be appreciated.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.