Comments (8)
Hi @luax, this is on my list, but unfortunately haven't gotten around to it yet. For what it's worth, I would like to get this fixed as soon as possible since I think this is important to support, but since Node.js Language Metrics is a beta feature, it becomes a little harder to prioritize.
Nonetheless, I will keep this issue updated with my progress.
from heroku-nodejs-plugin.
Hi @luax - this is the right place for this bug. I will investigate this and report back. It has to do with the plugin's use of require
when ES Modules have been enabled. The plugin will need to do ES module-style imports when it's enabled, so I need to figure out what that looks like.
from heroku-nodejs-plugin.
Thanks @danielleadams! I also created a support ticket.
Here is a reproducible example:
-
package.json
{ "name": "heroku-test", "version": "1.0.0", "main": "index.js", "license": "MIT", "type": "module", "engines": { "node": "14.x" }, "dependencies": { "express": "4.17.1" } }
-
index.js
import express from 'express'; const app = express() const port = process.env.PORT || 3000 app.get('/', (req, res) => res.send('Hello World!')) app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
from heroku-nodejs-plugin.
Sorry but are there any news on when this might be solved @danielleadams?
My current workaround is booting with:
web: echo { \"type\": \"commonjs\" } > /app/.heroku/heroku-nodejs-plugin/package.json && node index.js
Or not use native modules as it seems risky to add things to /app/.heroku
on the fly.
Thanks!
from heroku-nodejs-plugin.
I face the same problem on a Hobby Dyno at Heroku. It is definitely an issue with heroku-nodejs-plugin since I dont face it on a Free Dyno which doesnt have metrics plugin but running the same code. Node v14.5
from heroku-nodejs-plugin.
Hi,
I'm also having the same issue after migrating my Node project to "type": "module" and killing all the require in my project...
I'll try luax's solution.
from heroku-nodejs-plugin.
Can confirm also.
When turning on this switch:
and setting "type": "module" in the package.json, then the app crashes with the mentioned error.
from heroku-nodejs-plugin.
The fix will go out with the next release.
from heroku-nodejs-plugin.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heroku-nodejs-plugin.