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

feat: support nuxt4 #3009

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"typescript.referencesCodeLens.enabled": true,
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.useFlatConfig": true
}
11 changes: 9 additions & 2 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default defineNuxtConfig({
extends: ['@nuxt/ui-pro'],
modules: ['@nuxt/content', '@nuxt/ui', '@nuxtjs/fontaine', '@nuxtjs/google-fonts', 'nuxt-og-image'],
routeRules: { '/api/search.json': { prerender: true } },

vite: {
$client: {
build: {
Expand All @@ -14,12 +15,16 @@ export default defineNuxtConfig({
}
}
},

// SEO
site: { url: 'https://i18n.nuxtjs.org' },

// Nuxt UI & UI Pro
ui: { icons: ['heroicons', 'simple-icons'] },
uiPro: { license: 'oss' }, // special license for nuxt & nuxt-modules orgs

// special license for nuxt & nuxt-modules orgs
uiPro: { license: 'oss' },

hooks: {
// Define `@nuxt/ui` components as global to use them in `.md` (feel free to add those you need)
'components:extend': components => {
Expand All @@ -34,12 +39,14 @@ export default defineNuxtConfig({

// Fonts
fontMetrics: { fonts: ['DM Sans'] },

googleFonts: {
display: 'swap',
download: true,
families: { 'DM+Sans': [400, 500, 600, 700] }
},

devtools: { enabled: true },
typescript: { strict: false }
typescript: { strict: false },
compatibilityDate: '2024-07-02'
})
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"devDependencies": {
"@iconify-json/heroicons": "^1.1.19",
"@iconify-json/simple-icons": "^1.1.89",
"@nuxt/content": "^2.12.0",
"@nuxt/ui-pro": "^1.0.1",
"@nuxtjs/fontaine": "^0.4.1",
"@nuxt/content": "^2.13.0",
"@nuxt/ui-pro": "^1.3.1",
"@nuxtjs/fontaine": "^0.4.3",
"@nuxtjs/google-fonts": "^3.1.3",
"nuxt": "^3.9.3",
"nuxt-og-image": "^2.2.4",
"nuxt": "npm:nuxt-nightly@latest",
"nuxt-og-image": "^2.2.6",
"vue-tsc": "^2.0.1"
}
}
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
"pnpm": {
"overrides": {
"@nuxtjs/i18n": "link:.",
"jiti": "1.21.0",
"consola": "^3"
"nuxt": "npm:nuxt-nightly@latest"
}
},
"dependencies": {
Expand All @@ -82,7 +81,7 @@
"@intlify/unplugin-vue-i18n": "^5.0.0-beta.3",
"@intlify/utils": "^0.12.0",
"@miyaneee/rollup-plugin-json5": "^1.2.0",
"@nuxt/kit": "^3.12.3",
"@nuxt/kit": "npm:@nuxt/kit-nightly@latest",
"@rollup/plugin-yaml": "^4.1.2",
"@vue/compiler-sfc": "^3.4.31",
"debug": "^4.3.5",
Expand All @@ -106,7 +105,7 @@
"@babel/types": "^7.24.7",
"@eslint/js": "9.5.0",
"@nuxt/module-builder": "^0.6.0",
"@nuxt/schema": "^3.12.3",
"@nuxt/schema": "npm:@nuxt/schema-nightly@latest",
"@types/debug": "^4.1.9",
"@types/eslint": "^8.56.6",
"@unhead/vue": "^1.8.8",
Expand All @@ -126,7 +125,7 @@
"lint-staged": "^15.2.7",
"nitropack": "^2.9.7",
"npm-run-all2": "^6.2.0",
"nuxt": "^3.12.3",
"nuxt": "npm:nuxt-nightly@latest",
"ofetch": "^1.3.4",
"playwright": "^1.38.1",
"prettier": "^3.3.2",
Expand Down
13 changes: 12 additions & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@ import ModuleExperimental from './module-experimental'
export default defineNuxtConfig({
// devLogs broken, should be resolved by https://github.com/nuxt/nuxt/commit/b3ced3d694c89344c8e77b804a2dc76434d27668
// remove after updating to Nuxt >3.11.0
future: {
compatibilityVersion: 4
},

features: {
devLogs: false
},

experimental: {
typedPages: true
},

vite: {
// Prevent reload by optimizing dependency before discovery
optimizeDeps: {
include: ['@unhead/vue']
}
},

extends: ['layers/i18n-layer'],

modules: [
(_, nuxt) => {
console.log(nuxt.options._installedModules)
Expand Down Expand Up @@ -101,6 +109,7 @@ export default defineNuxtConfig({
'@nuxtjs/i18n',
'@nuxt/devtools'
],

vite: {
build: {
minify: false
Expand Down Expand Up @@ -194,5 +203,7 @@ export default defineNuxtConfig({
// // redirectOn: 'root'
// },
vueI18n: './vue-i18n.options.ts'
}
},

compatibilityDate: '2024-07-02'
})
1,215 changes: 890 additions & 325 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ packages:
- 'docs'
- 'playground'
- 'specs/fixtures/*'
- 'specs/fixtures/issues/*'
2 changes: 1 addition & 1 deletion specs/browser_language_detection/no_prefix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ await setup({
// overrides
nuxtConfig: {
i18n: {
debug: true,
// debug: true,
strategy: 'no_prefix',
detectBrowserLanguage: {
useCookie: true,
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/basic/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import CustomModule from './module'

// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: [CustomModule, '@nuxtjs/i18n'],

i18n: {
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/basic_usage/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
devtools: { enabled: true },
modules: ['./layer-module', './installer-module', '@nuxtjs/i18n'],
runtimeConfig: {
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/different_domains/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import CustomModule from './module'

// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: [CustomModule, '@nuxtjs/i18n'],

i18n: {
Expand Down
8 changes: 7 additions & 1 deletion specs/fixtures/inline_options/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ import i18nModule from '../external_module/i18n-module'

// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: [
i18nModule,
[
'@nuxtjs/i18n',
{
debug: false,
// debug: false,
lazy: false,
langDir: 'lang',
defaultLocale: 'en',
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/1888/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
locales: [
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2151/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
ssr: true,
components: true,
imports: {
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2220/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import locales from './locales'

export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
lazy: true,
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2226/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
locales: ['en', 'de'],
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2247/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
baseUrl: 'https://abwaab.com',
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2288/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
baseUrl: 'https://abwaab.com',
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2315/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
bundle: {
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/issues/2590/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
devtools: { enabled: false },
modules: ['./modules/i18n-module']
})
6 changes: 6 additions & 0 deletions specs/fixtures/layers/layer-domain/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
i18n: {
// lazy: false,
// differentDomains: true,
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/layers/layer-lazy/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
i18n: {
langDir: 'locales',
locales: [
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/layers/layer-locale-arabic/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
i18n: {
langDir: 'locales',
locales: [
Expand Down
9 changes: 8 additions & 1 deletion specs/fixtures/layers/layer-pages/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({})
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
}
})
6 changes: 6 additions & 0 deletions specs/fixtures/layers/layer-server/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
i18n: {
experimental: {
localeDetector: './localeDetector.ts'
Expand Down
6 changes: 6 additions & 0 deletions specs/fixtures/layers/layer-simple/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
i18n: {
locales: ['fr', 'nl']
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
export default defineNuxtConfig({
// This reverts the new srcDir default from `app` back to your root directory
srcDir: '.',
// This specifies the directory prefix for `app/router.options.ts` and `app/spa-loading-template.html`
dir: {
app: 'app'
},
modules: ['@nuxtjs/i18n'],
i18n: {
locales: ['fr', 'nl', 'en'],
Expand Down
Loading