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

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

Closed
ajcrites opened this issue Jan 16, 2019 · 1 comment
Closed

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

ajcrites opened this issue Jan 16, 2019 · 1 comment

Comments

@ajcrites
Copy link

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.

@futagoza
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants