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

Support .mjs files #592

Closed
maierfelix opened this issue Mar 3, 2019 · 3 comments
Closed

Support .mjs files #592

maierfelix opened this issue Mar 3, 2019 · 3 comments
Labels

Comments

@maierfelix
Copy link

maierfelix commented Mar 3, 2019

Is this a BUG or a FEATURE REQUEST?:
Feature Request (or bug?)

What happened:
Unable to run .mjs file, error is:

(function (exports, require, module, __filename, __dirname) { import fs from "fs";
                                                                     ^^
SyntaxError: Unexpected identifier
    at new Script (vm.js:73:7)
    at createScript (vm.js:245:10)
    at Object.runInThisContext (vm.js:297:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
...

What you expected to happen:
Not dat

How to reproduce it (as minimally and precisely as possible):
Create index.mjs:

import fs from "fs";
// bla

Bundle with:

nexe --input index.mjs --output test.exe --verbose --target windows-x64-10.9.0 --flags ["--experimental-modules"]

Environment

  • Platform(OS/Version): Windows 10 x64
  • Host Node Version: v11.9.0
  • Target Node Version: v10.9.0
  • Nexe version: nexe 3.0.0-beta.15
  • Python Version: 2.7.15

Edit: I'm using pre-built v10.9.0 binary from releases

@calebboyd
Copy link
Member

I think I will implement this using esm instead of the node flag. I don't really want to write much code around the .mjs file type...

@maierfelix
Copy link
Author

@calebboyd any updates on this?

@calebboyd
Copy link
Member

Closing in favor of #815

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants