{"id":20270,"library":"po-loader","title":"po-loader","description":"Webpack loader for translating .po files (GNU gettext) into JSON. Uses po2json under the hood, supports mozilla/nunjucks, Jed, and other formats. Version 0.7.0 (latest, 2017). Sync and async usage; often paired with Jed for i18n. No updates since 2017, works with webpack v1 only. Not actively maintained; consider @lingui/webpack or i18n-webpack-plugin.","status":"maintenance","version":"0.7.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/perchlabs/po-loader","tags":["javascript"],"install":[{"cmd":"npm install po-loader","lang":"bash","label":"npm"},{"cmd":"yarn add po-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add po-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for parsing .po files; must be >=1.0.0-beta-3","package":"po2json","optional":false}],"imports":[{"note":"Loader applies automatically if configured in webpack.config","wrong":"require('./locale.po');","symbol":"po-loader","correct":"import messages from './locale.po';"},{"note":"Must be chained with json loader (or raw loader if you want JSON)","wrong":"var messages = require('po-loader!./locale.po');","symbol":"po-loader","correct":"var messages = require('json!po!./locale.po');"},{"note":"For async usage, use dynamic import(/* webpackChunkName: 'locale' */ './locale.po')","wrong":"import locale from './locale.po'; // missing async loading","symbol":"po-loader","correct":"import localePromise from './locale.po'; // then call .then() or await"}],"quickstart":{"code":"// webpack.config.js\n{\n  test: /\\.po$/,\n  loader: 'json!po',\n  exclude: /node_modules/\n}\n\n// entry.js\nimport Jed from 'jed';\n\nasync function init() {\n  const localeData = await import('./locale/en_US/LC_MESSAGES/messages.po');\n  const i18n = new Jed(localeData);\n  console.log(i18n.gettext('Hello'));\n}\n\ninit();","lang":"javascript","description":"Webpack config to load .po files with po-loader and json-loader, then async import a .po file and use Jed."},"warnings":[{"fix":"Upgrade to webpack 1 or switch to a modern i18n webpack plugin like @lingui/webpack","message":"po-loader requires webpack 1.x only; does not work with webpack 2+ modular loaders. Use json!po syntax which breaks in webpack 2+","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Use po2json@1.0.0-beta-3 exactly in package.json","message":"po2json peer dependency must be >=1.0.0-beta-3, but that version may have breaking changes. Always pin exact version.","severity":"deprecated","affected_versions":">=0.7.0"},{"fix":"Always use json!po prefix in require or configure in webpack.config with json!po loader string","message":"Requiring .po files without the json loader prefix (json!po) will output raw po2json format, not run through po-loader","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use import(`${LOCALE_ROOT}/${locale}/LC_MESSAGES/messages.po`) with LOCALE_ROOT as a constant string","message":"Dynamic import path must match the regex for webpack to create separate bundles; otherwise returns undefined","severity":"breaking","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add po-loader and json-loader to webpack config: { test: /\\.po$/, loader: 'json!po' }","cause":"No loader configured for .po files in webpack","error":"Module parse failed: Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type."},{"fix":"npm install po2json@>=1.0.0-beta-3 --save-dev or --save","cause":"Missing peer dependency po2json","error":"Cannot find module 'po2json'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}