Skip to content

Fixed build for examples/nextjs-swc. #2146

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

Closed
wants to merge 1 commit into from
Closed
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
19 changes: 10 additions & 9 deletions examples/nextjs-swc/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
swcPlugins: [['@lingui/swc-plugin', {}]],
turbo: {
rules: {
'*.po': {
loaders: ['@lingui/loader'],
as: '*.js'
}
}
}
}
},
webpack: (config) => {
config.module.rules.push({
test: /\.po$/,
use: {
loader: '@lingui/loader',
},
})
return config
},
Comment on lines -6 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

This was explicitly changed to use Turbopack in the #2073 PR

}

export default nextConfig
1 change: 1 addition & 0 deletions examples/nextjs-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@lingui/core": "^5.1.2",
"@lingui/macro": "^5.1.2",
"@lingui/react": "^5.1.2",
"negotiator": "^0.6.3",
"next": "15.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HomePage } from '../../../components/HomePage'
import { initLingui } from '../../../initLingui'

export default async function Page(props) {
export default async function Page(props: any) {
const lang = (await props.params).lang
initLingui(lang)
return <HomePage />
Expand Down
3 changes: 1 addition & 2 deletions examples/nextjs-swc/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { LinguiClientProvider } from '../../components/LinguiClientProvider'
import { initLingui, PageLangParam } from '../../initLingui'
import React from 'react'
import { t } from '@lingui/macro'
import { setI18n } from '@lingui/react/server'

export async function generateStaticParams() {
return linguiConfig.locales.map((lang) => ({ lang }))
Expand All @@ -18,7 +17,7 @@ export async function generateMetadata(props: PageLangParam) {
}
}

export default async function RootLayout({ children, params }) {
export default async function RootLayout({ children, params }: any) {
const lang = (await params).lang
initLingui(lang)

Expand Down
6 changes: 4 additions & 2 deletions examples/nextjs-swc/src/app/[lang]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Link from "next/link"

export default function Index() {
return (
<>
This is the homepage of the demo app. This page is not localized. You can
go to the <a href="/app-router-demo">App router demo</a> or the{' '}
<a href="/pages-router-demo">Pages router demo</a>.
go to the <Link href="/app-router-demo">App router demo</Link> or the{' '}
<Link href="/pages-router-demo">Pages router demo</Link>.
</>
)
}
2 changes: 1 addition & 1 deletion examples/nextjs-swc/src/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ msgstr "Serbian"
msgid "Spanish"
msgstr "Spanish"

#: src/app/[lang]/layout.tsx:16
#: src/components/HomePage.tsx:21
#: src/app/[lang]/layout.tsx:16
msgid "Translation Demo"
msgstr "Translation Demo"

Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-swc/src/locales/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ msgstr "Serbio"
msgid "Spanish"
msgstr "Español"

#: src/app/[lang]/layout.tsx:16
#: src/components/HomePage.tsx:21
#: src/app/[lang]/layout.tsx:16
msgid "Translation Demo"
msgstr "Demostración de Traducción"

Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-swc/src/locales/pseudo.po
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ msgstr ""
msgid "Spanish"
msgstr ""

#: src/app/[lang]/layout.tsx:16
#: src/components/HomePage.tsx:21
#: src/app/[lang]/layout.tsx:16
msgid "Translation Demo"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-swc/src/locales/sr.po
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ msgstr "Српски"
msgid "Spanish"
msgstr "Шпански"

#: src/app/[lang]/layout.tsx:16
#: src/components/HomePage.tsx:21
#: src/app/[lang]/layout.tsx:16
msgid "Translation Demo"
msgstr "Демо Превод"

Expand Down
19 changes: 19 additions & 0 deletions examples/nextjs-swc/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,24 @@ __metadata:
languageName: node
linkType: hard

"@lingui/macro@npm:^5.1.2":
version: 5.1.2
resolution: "@lingui/macro@npm:5.1.2"
dependencies:
"@lingui/core": ^5.1.2
"@lingui/react": ^5.1.2
peerDependencies:
"@lingui/babel-plugin-lingui-macro": 5.1.2
babel-plugin-macros: 2 || 3
peerDependenciesMeta:
"@lingui/babel-plugin-lingui-macro":
optional: true
babel-plugin-macros:
optional: true
checksum: 5161f4cfb4113c75020ce4a8e4a1ecef0c5f2aa5c1214c00861d0c7d2f6bbdcb36ed992137167b81229dfb45de571ad507de5b42aabdb030b79271132d819786
languageName: node
linkType: hard

"@lingui/message-utils@npm:^5.1.2":
version: 5.1.2
resolution: "@lingui/message-utils@npm:5.1.2"
Expand Down Expand Up @@ -4986,6 +5004,7 @@ __metadata:
"@lingui/cli": ^5.1.2
"@lingui/core": ^5.1.2
"@lingui/loader": ^5.1.2
"@lingui/macro": ^5.1.2
"@lingui/react": ^5.1.2
"@lingui/swc-plugin": ^5.0.1
"@types/negotiator": ^0.6.3
Expand Down
Loading