Skip to content

Example of Default Output that is compatible for Node and Browsers #233

Closed
@mbalex99

Description

@mbalex99

In the main README.md, it states:

By default the generated JS uses ES modules and is compatible with both Node and browsers (but will likely require a bundler for both use cases).

But it seems like the ES module can't be consumed by node directly. Like I can't do this:

const myLib = require('myLib')
const sum = myLib.add(1, 2)
console.log(sum)

However the --nodejs flag for the compiler allows this to work seamlessly. Do we need to use webpack for both browser setup and node setup with the default es6 modules?

Ideally, it would be fine if the default usage in the browser would need webpack, but what is the ideal build setup for using it in nodejs without webpack?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe could use some help fixing this issue!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions