Skip to content

Instantly share code, notes, and snippets.

@kofeigen
kofeigen / README.md
Last active June 13, 2021 22:41
Merge JSON files and inject merged JSON object into JS bundle using webpack.DefinePlugin

Merging JSON files and injecting into bundle with webpack.DefinePlugin

Use Webpack's webpack.DefinePlugin to assign a value (a serialized JSON object) to a global variable at compile time. This global variable can then be assigned to the i18next "resources" property to initialize translations.

Installation

In the root folder, with npm run:

npm install