polyglot-po-loader
v0.0.6
Published
Webpack loader to load po file and convert them to polyglot json format [readme](https://github.com/marmelab/polyglot-po/blob/master/packages/polyglot-po-loader/readme.md)
Downloads
3
Readme
polyglot-po-loader
Webpack loader to load po file and convert them to polyglot json format readme
Install
$ npm install -g polyglot-po-loader
# or
$ yarn global add polyglot-po-loader
Usage
Add the csv-loader to your webpack configuration:
const config = {
module: {
rules: [{
test: /\.po$/,
loader: 'polyglot-po-loader',
}]
}
With create-react-app
You will need react-app-rewired to add the loader into the webpack-config.
With react-app-rewired, you can edit the webpack config inside the config-overrides.js
.
There is a gotcha though, the create-react-app default webpack configuration possess a catch all file-loader
.
For polyglot-po-loader to properly work, you need to pass it before this loader, like so:
// config-overrides.js
const path = require('path');
module.exports = config => {
const lastLoader = config.module.rules.pop();
lastLoader.oneOf.unshift({
test: /\.po$/,
use: [{
loader: 'polyglot-po-loader',
}],
});
config.module.rules.push(lastLoader);
return config;
};