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

fix(module): remove deprecated resolveModule #2298

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'fs'
import {
addPlugin,
defineNuxtModule,
resolveModule,
createResolver,
addImports,
addComponentsDir,
Expand Down Expand Up @@ -307,7 +306,7 @@ export default defineNuxtModule<ModuleOptions>({
},
async setup (options, nuxt) {
const { resolve } = createResolver(import.meta.url)
const resolveRuntimeModule = (path: string) => resolveModule(path, { paths: resolve('./runtime') })
const resolveRuntimeModule = (path: string) => resolve('./runtime', path)
Copy link
Member

@pi0 pi0 Sep 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that resolve just joint paths. It doesn't check extensions and they are not alternatives. You might want to use resolver.resolePath but have to try

Copy link
Member Author

@farnabaz farnabaz Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK almost in every case of our usages Nuxt takes care of the extension matching and module works fine with resolve function

Am I wrong about extension matching?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to rely on that (and it works with published module) surely!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the build in a real project and it's fine. Will merge and check on edge channel too.
Thanks

// Ensure default locale alway is the first item of locales
options.locales = Array.from(new Set([options.defaultLocale, ...options.locales].filter(Boolean))) as string[]

Expand Down