Skip to content

require.main === module is different after ncc #224

Closed

Description

@ajcrites

This is node.js's recommended method for determining the main module.

If you have a file like:

// index.js
console.log(require.main === module);
$ node .
true
$ ncc run .        # or build
false

ncc should have the output file function the same as when using node.

Activity

  1. futagoza commented on Jan 17, 2019

    @futagoza

    Can't this be fixed by simply doing this:

    {
        plugins: [
            new webpack.DefinePlugin( {
                "require.main": "require.main",
            } ),
        ],
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions