@traduki/webpack-plugin-traduki

Webpack plugin for Traduki

Usage no npm install needed!

<script type="module">
  import tradukiWebpackPluginTraduki from 'https://cdn.skypack.dev/@traduki/webpack-plugin-traduki';
</script>

README

@traduki/webpack-plugin-traduki

npm

See main github repository readme.md

Examples

Install

npm install --save-dev @traduki/webpack-plugin-traduki
npm install @traduki/runtime # or @traduki/react if you're using React

Usage

Create a webpack.config.js configuration file and configure the plugin and loader:

// webpack.config.js
const TradukiWebpackPlugin = require('@traduki/webpack-plugin-traduki');

module.exports = {
    // ...
    plugins: [
        new TradukiWebpackPlugin({
            /*
             * Description: File name of the precompiled messages bundles
             * Default: '[name].[locale].js'
             */
           filename: '[name].[locale].js',
            /*
             * Description: Check consistency of messages keys for each locale
             * Default: 'warn'
             */
            strict: 'warn', // false | 'error'
        }),
    ],
    module: {
        rules: [
            // ...
            {
                test: /\.messages\.yaml$/,
                use: TradukiWebpackPlugin.loader,
            },
            // ...
        ],
    },
    // ...
};