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

Invoke visitors in Program exit #26

Closed
tbranyen opened this issue Sep 27, 2019 · 2 comments · Fixed by #30
Closed

Invoke visitors in Program exit #26

tbranyen opened this issue Sep 27, 2019 · 2 comments · Fixed by #30

Comments

@tbranyen
Copy link

This is a request to move the path traversal for CallExpression/Import/Export/etc. to the Program exit. I have a sample repo to load a React application in ESM and use this module to apply the import path resolution.

The problem is that my CJS->ESM plugin must run first, and then this plugin. Since Babel doesn't have a way to properly schedule tasks, the fix here would be to run later.

module.exports = ({types: t}) => ({
	inherits: syntax.default,
	visitor: {
		Program: {
			exit(path, { opts }) {
				path.traverse({
					CallExpression(path) {

I can open a PR to show the change as well.

@tbranyen
Copy link
Author

Issued PR #27

@tbranyen
Copy link
Author

Link to repository if you're interested: https://github.com/tbranyen/react-babel-esm

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

Successfully merging a pull request may close this issue.

1 participant