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

mjs extension support #626

Closed
mysuf opened this issue Nov 3, 2023 · 1 comment
Closed

mjs extension support #626

mysuf opened this issue Nov 3, 2023 · 1 comment

Comments

@mysuf
Copy link

mysuf commented Nov 3, 2023

I decided to go mjs way instead of type: module, but umzug can't handle these files atm.

require doesn't work with esm so then maybe it would be nice to make resolver async so I can handle these files with dynamic import.

Now I made it work like this:

		resolve: ({ name, path, context }) => {
			return {
				// adjust the parameters Umzug will
				// pass to migration methods when called
				name,
				up: async () => {
					const { up } = await import(path);
					return up({ context });
				},
				down: async () => {
					const { down } = await import(path);
					return down({ context });
				},
			};
		},

Thanks

@mmkal
Copy link
Contributor

mmkal commented Nov 6, 2023

Closing in favour of #608

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