Skip to content

Commit 78ad09f

Browse files
authored
fix: loader works smoothly on webpack 5 & 4 (#1046)
1 parent 8590c1a commit 78ad09f

7 files changed

Lines changed: 669 additions & 3893 deletions

File tree

examples/next-js/.babelrc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
{
22
"presets": [
3-
[
4-
"next/babel",
5-
{
6-
"preset-env": {},
7-
"transform-runtime": {},
8-
"styled-jsx": {},
9-
"class-properties": {}
10-
}
11-
]
3+
"next/babel"
124
],
135
"plugins": ["macros"]
146
}

examples/next-js/lingui-example/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ i18n.loadLocaleData("cs", { plurals: cs })
1010
* many ways how to load messages — from REST API, from file, from cache, etc.
1111
*/
1212
export async function activate(locale: string) {
13-
const { messages } = await import(`../locale/${locale}/messages.js`)
13+
const { messages } = await import(`../locale/${locale}/messages.po`)
1414
i18n.load(locale, messages)
1515
i18n.activate(locale)
1616
}

examples/next-js/next.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
webpack: (config, { isServer }) => {
3+
config.module.rules = [
4+
...config.module.rules,
5+
{
6+
test: /\.po/,
7+
use: [
8+
{
9+
loader: "@lingui/loader",
10+
},
11+
],
12+
},
13+
];
14+
15+
return config;
16+
},
17+
future: {
18+
webpack5: true,
19+
},
20+
}

examples/next-js/package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@
1010
"start": "next start"
1111
},
1212
"dependencies": {
13-
"@lingui/core": "^3.5.1",
14-
"@lingui/react": "^3.5.1",
15-
"classnames": "^2.2.6",
16-
"next": "10.0.1",
17-
"react": "17.0.1",
18-
"react-dom": "17.0.1"
13+
"@lingui/core": "^3.8.9",
14+
"@lingui/react": "^3.8.9",
15+
"classnames": "^2.3.1",
16+
"next": "10.1.3",
17+
"react": "17.0.2",
18+
"react-dom": "17.0.2"
1919
},
2020
"devDependencies": {
21-
"@lingui/cli": "^3.5.1",
22-
"@lingui/loader": "^3.5.1",
23-
"@lingui/macro": "^3.5.1",
24-
"@types/react": "^16.9.56",
25-
"babel-plugin-macros": "^2.8.0",
26-
"typescript": "^4.0.5"
21+
"@lingui/cli": "^3.8.9",
22+
"@lingui/loader": "^3.8.9",
23+
"@lingui/macro": "^3.8.9",
24+
"@types/react": "^17.0.3",
25+
"babel-plugin-macros": "^3.0.1",
26+
"typescript": "^4.2.4",
27+
"webpack": "^5.0.0"
2728
}
2829
}

examples/next-js/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"dom.iterable",
88
"esnext"
99
],
10+
"paths": {
11+
"lingui-example/*": ["./lingui-example/*"]
12+
},
1013
"allowJs": true,
1114
"skipLibCheck": true,
1215
"strict": false,

0 commit comments

Comments
 (0)