Giter VIP home page Giter VIP logo

Comments (7)

jamo avatar jamo commented on May 21, 2024 3

It certainly is possible, here is a sample script with dropping flow annotations and node inspect while running micro-dev

    "dev": "node inspect -r ./node_modules/flow-remove-types/register.js ./node_modules/.bin/micro-dev lib/index.js",

from micro-dev.

retrixe avatar retrixe commented on May 21, 2024 2

Huh, it seems I can't load .mjs as my entry point via micro-dev as it needs ESM to be required via CommonJS.

from micro-dev.

Zertz avatar Zertz commented on May 21, 2024 1

The command above didn't seem to work for me so I used the method described in a similar issue on micro

node --inspect node_modules/.bin/micro-dev -p 3300

from micro-dev.

retrixe avatar retrixe commented on May 21, 2024

from micro-dev.

timneutkens avatar timneutkens commented on May 21, 2024

micro-dev loads your server file. It doesn't spawn a new Node.js instance or something similar. So what @jamo posted should work as expected 👍

from micro-dev.

leo avatar leo commented on May 21, 2024

Closing this now. Please use the solution suggested above.

from micro-dev.

zababurinsv avatar zababurinsv commented on May 21, 2024

Hi. Yesterday my code worked.

server: express
node: module index.mjs
import express from "express";

const app = express();

app.get('*', (req, res) => {
res.status(200).send({key:'test'});
});

export default app

now:
{
"version": 2,
"name": "WebDav",
"builds": [
{ "src": "index.mjs", "use": "
@now
/node" }
],
"routes": [
{ "src": "/", "dest": "index.mjs" }
]
}

but today it is not work.
What's happend ?

i get an error

SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/tmp/zeit-fun-02176ca18c0dc/___now_launcher.js:21:18)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)

How can i use *.mjs with express ?

from micro-dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.