Skip to content

Support Node 14's native ES module imports #482

Open
@stasm

Description

@stasm

Currently, @fluent packages are published as type: "commonjs". This means that in Node 14, you can only import then as if they were CommonJS modules:

  • From other cjs files:
let {FluentBundle} = require("@fluent/bundle");
let bundle = new FluentBundle();

// Or:
let fluent_bundle = require("@fluent/bundle");
let bundle = new fluent_bundle.FluentBundle();
  • From mjs files:
import fluent_bundle from "@fluent/bundle";
let bundle = new fluent_bundle.FluentBundle();

It would be nice to be able to use the following import form, too, just like we can do today in browsers:

import {FluentBundle} from "@fluent/bundle";
let bundle = new FluentBundle();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions