Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #782 from przlada/translations
Browse files Browse the repository at this point in the history
Start using Intl another attempt
  • Loading branch information
dominik-zeglen authored Jun 26, 2020
2 parents c344fe6 + 2351ce6 commit b296500
Show file tree
Hide file tree
Showing 115 changed files with 3,417 additions and 583 deletions.
50 changes: 44 additions & 6 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
module.exports = {
presets: [
module.exports = api => {
const isExtract = api.env("extract");
const isTest = api.env("test");
const isStorybook = api.env("storybook");

const ignore =
isTest || isStorybook
? []
: ["**/*.test.ts", "**/*.test.tsx", "src/storybook"];
const presets = [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
plugins: [
[
"@babel/preset-typescript",
{
allowNamespaces: true,
},
],
];
const plugins = [
"@babel/plugin-syntax-dynamic-import",
"transform-class-properties",
"@babel/transform-runtime",
"@babel/plugin-proposal-optional-chaining",
],
[
"react-intl-auto",
{
filebase: true,
includeExportName: "all",
removePrefix: "src/",
},
],
];
if (isExtract) {
plugins.push([
"react-intl",
{
extractFromFormatMessageCall: true,
messagesDir: "dist/locale/",
},
]);
}

plugins.push("macros");

return {
ignore,
plugins,
presets,
};
};
8 changes: 8 additions & 0 deletions config/webpack/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ module.exports = ({ sourceDir, distDir }) => ({
},
test: /\.tsx?$/,
},
{
exclude: /node_modules/,
loader: "babel-loader",
options: {
configFile: "./babel.config.js",
},
test: /\.(jsx?|tsx?)$/,
},
{
test: /\.(woff2?|ttf|eot)$/,
use: [
Expand Down
Loading

0 comments on commit b296500

Please sign in to comment.