{"id":20067,"library":"globalize-webpack-plugin","title":"globalize-webpack-plugin","description":"Webpack plugin for Globalize.js that handles CLDR data loading, formatter precompilation, and locale chunk splitting. Current stable version is 3.0.0, compatible with Webpack 4 and Globalize ^1.3.0. Key differentiator: optimizes Globalize performance by precompiling formatters at build time for production, while allowing dynamic CLDR loading during development for faster HMR. Requires splitting code into vendor, globalize-compiled, and application chunks. Supports multiple locales and output customization.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/rxaviers/globalize-webpack-plugin","tags":["javascript","globalize","webpack","plugin"],"install":[{"cmd":"npm install globalize-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add globalize-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add globalize-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"CLDR data required at build time for locale support","package":"cldr-data","optional":false},{"reason":"Core library for internationalization","package":"globalize","optional":false},{"reason":"Time zone data for date/time formatting","package":"iana-tz-data","optional":true},{"reason":"Required peer dependency for plugin to work","package":"webpack","optional":false}],"imports":[{"note":"Plugin is CJS; ESM import will fail unless using a CJS interop loader.","wrong":"import GlobalizePlugin from 'globalize-webpack-plugin';","symbol":"GlobalizePlugin","correct":"const GlobalizePlugin = require('globalize-webpack-plugin');"},{"note":"Must be instantiated with options; see README for full option list.","wrong":"Using the plugin without providing required options (production, supportedLocales).","symbol":"n/a","correct":"In webpack.config.js: plugins: [new GlobalizePlugin({ ... })]"},{"note":"Restriction: split code into vendor, globalize-compiled, and app chunks.","wrong":"Bundling everything together without chunking; plugin expects at least three chunks.","symbol":"n/a","correct":"Include 'globalize' in vendor chunk and 'globalize-compiled-*' as separate chunks."}],"quickstart":{"code":"const path = require('path');\nconst webpack = require('webpack');\nconst GlobalizePlugin = require('globalize-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name].js'\n  },\n  plugins: [\n    new GlobalizePlugin({\n      production: process.env.NODE_ENV === 'production',\n      developmentLocale: 'en',\n      supportedLocales: ['en', 'es'],\n      messages: 'messages/[locale].json',\n      output: 'globalize-compiled-[locale].[hash].js'\n    })\n  ]\n};","lang":"javascript","description":"Example webpack configuration using GlobalizePlugin with production/development mode, English and Spanish locales, and custom output filenames."},"warnings":[{"fix":"Upgrade to webpack 4 or use globalize-webpack-plugin v2.x for webpack 3, v1.x for webpack 2, v0.x for webpack 1.","message":"Webpack 4 required from v3.0.0; earlier Webpack versions are not supported.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade Node.js to >=4.3.0.","message":"Node.js <4.3.0 dropped in v1.0.0.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Migrate to webpack 2+ and use corresponding plugin version.","message":"Support for webpack 1 ended with v0.x releases.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Configure entry points to separate vendor libraries (including 'globalize') from application code; plugin will generate globalize-compiled chunks.","message":"Must split code into at least three chunks: vendor, globalize-compiled, and application (production only).","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to v1.0.1 or later, which includes a fix for compatibility with ModuleScopePlugin.","message":"Plugin does not work with create-react-app's ModuleScopePlugin without workaround (known issue).","severity":"gotcha","affected_versions":"<1.0.1"},{"fix":"Ensure CLDR data is loaded in development or use production mode for precompilation.","message":"Development mode (production: false) does not precompile formatters; CLDR data must be available at runtime.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install cldr-data as a dev dependency: npm install cldr-data --save-dev.","cause":"Missing dependency 'cldr-data'.","error":"Module not found: Can't resolve 'cldr-data' in ..."},{"fix":"Ensure globalize is included in a vendor chunk and imported in your entry file.","cause":"Globalize not included in the bundle or not loaded before plugin invocation.","error":"Globalize is not defined"},{"fix":"Check that the plugin is properly required and instantiated: new GlobalizePlugin({ ... }).","cause":"Typo or incorrect instantiation in webpack config.","error":"Invalid configuration. 'GlobalizePlugin' is not a valid plugin."},{"fix":"Verify that the locales listed in supportedLocales exist in your CLDR data and message files.","cause":"SupportedLocales not matching any locale in CLDR data or messages.","error":"globalize-compiled-en.[hash].js chunk not emitted"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}