Skip to content

mjs extension support #626

@mysuf

Description

@mysuf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions