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

ParseError: 'import' and 'export' may appear only with 'sourceType: module #30

Closed
federicodotta opened this issue Mar 6, 2021 · 2 comments

Comments

@federicodotta
Copy link

Hi!

With last versions of frida-compile I obtain again the exception "ParseError: 'import' and 'export' may appear only with 'sourceType: module'" that was fixed in #13.

By looking at the code in the repository it seems that the fix code in the pull request #13. is not present. Am I wrong?

Thank you a lot for your support and for your great job!

@gergesh
Copy link
Contributor

gergesh commented Apr 30, 2021

If you encounter this issue while trying to include dependencies from npm, try npm installing them prior to running frida-build.
Edit: I played around with it some more, my previous suggestion wasn't very helpful. My situation is this:
I have a module based on frida-module-example, which imports frida-java-bridge/lib/android. Running frida-compile for that results in the error Cannot find module, but that is resolved after adding it as a dev dependency.
I then have an agent based on frida-agent-exmaple which imports myModule/foo/bar. In myModule/foo/bar there is an import statement, which is displayed in the error as described above. Importing just myModule, however, works.
I assume this is because using the nested import path results in the typescript file being used and not the compiled javascript file from the dist/ directory, but I really don't know.

@federicodotta
Copy link
Author

Solved changing the import/export syntax in my NodeJS code from ES6 to ES5 as described here.

Federico

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