1.0.0 • Published 2 years ago

ts-i18n-webpack-plugin v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ts-i18n-webpack-plugin

Webpack plugin for running ts-i18n

Usage

Install the npm package:

npm i --save-dev ts-i18n-webpack-plugin

Webpack

Add the plugin to your webpack.config.js

module.exports = {
  plugins: [
    new TsI18nWebpackPlugin({
      inputDirectory: 'i18n/src',
      outputDirectory: 'i18n/generated',
      defaultLanguage: 'en'
    })
    ...
  ]
  ...
}

See the webpack and ts-i18n docs for more details.

Create React App (using Craco)

Install the npm packages:

npm i --save-dev ts-i18n-webpack-plugin @craco/craco

Create a craco.config.js file with the following:

const TsI18nWebpackPlugin = require("ts-i18n-webpack-plugin");

module.exports = {
  webpack: {
    plugins: {
      add: [
        new TsI18nWebpackPlugin({
          inputDirectory: 'i18n',
          outputDirectory: 'src/i18n',
          defaultLanguage: 'en',
        }),
      ],
    },
  },
};

Update your package.json file to replace the calls to react-scripts in scripts with craco:

{
  "scripts": {
    "start": "craco start",
    "build": "craco build",
    "test": "craco test"
    ...
  }
  ...
}

See the craco and ts-i18n docs for more details.

1.0.0

2 years ago

0.1.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago