Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES module support for Node JS #277

Open
ghost opened this issue Oct 10, 2022 · 0 comments
Open

ES module support for Node JS #277

ghost opened this issue Oct 10, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 10, 2022

Standards compliant way to load module is ES Modules not CommonJS in Node.

E.g. ESM Declaration

export default async function MyFunc(context) {
  return {
      status: 200,
      body: "hello, world!\n"
  };
}

ESM module use

import {MyFunc} from "my-module.mjs";

vs

CommonJS declaraion

module.exports = async function(context) {
    return {
        status: 200,
        body: "hello, world!\n"
    };
}

CommonJS use

const myModule = require("my-modules.cjs);

Is there a way to make NODE's ESM's imports / module declarations work in Fission?

Tried it locally and it did not work. Could not find any mentions/examples in your repos either

ESM is the recommended way to build Node JS code these days

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

@sanketsudake sanketsudake transferred this issue from fission/fission Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant