-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.i18n.js
51 lines (47 loc) · 1.15 KB
/
webpack.i18n.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
const path = require("path");
const I18nPlugin = require("embed-i18n-webpack-plugin");
const TRANSLATIONS = {
pl: { greeting: { hello: "Witaj Swiecie" } },
en: { greeting: { hello: "Hello World" } },
};
module.exports = Object.entries(TRANSLATIONS).map(
([language, translation]) => ({
mode: "production",
entry: { index: path.join(__dirname, "src", "i18n.js") },
output: {
path: path.join(__dirname, "i18n-build"),
filename: `[name].${language}.js`,
},
plugins: [new I18nPlugin(translation)],
})
)
*/
const path = require("path");
const I18nPlugin = require("embed-i18n-webpack-plugin");
const TRANSLATIONS = {
fi: {
greeting: {
hello: "Terve maailma",
},
},
en: {
greeting: {
hello: "Hello world",
},
},
};
module.exports = Object.entries(TRANSLATIONS).map(
([language, translation]) => ({
mode: "production",
entry: {
index: path.join(__dirname, "src", "i18n.js"),
},
output: {
path: path.join(__dirname, "i18n-build"),
filename: `[name].${language}.js`,
},
plugins: [new I18nPlugin(translation)
],
})
);