Registry / web-framework / globalize-webpack-plugin

globalize-webpack-plugin

JSON →
library3.0.0jsnpmunverified

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.

npm install globalize-webpack-plugin
INSTALL
IMPORT
SIG · GLOBALIZE-WEBPACK-
G
globalize-webpack-plugin
web-frameworkjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GlobalizePlugin
const GlobalizePlugin = require('globalize-webpack-plugin');
import GlobalizePlugin from 'globalize-webpack-plugin';
Plugin is CJS; ESM import will fail unless using a CJS interop loader.
n/a
In webpack.config.js: plugins: [new GlobalizePlugin({ ... })]
Using the plugin without providing required options (production, supportedLocales).
Must be instantiated with options; see README for full option list.
n/a
Include 'globalize' in vendor chunk and 'globalize-compiled-*' as separate chunks.
Bundling everything together without chunking; plugin expects at least three chunks.
Restriction: split code into vendor, globalize-compiled, and app chunks.

Example webpack configuration using GlobalizePlugin with production/development mode, English and Spanish locales, and custom output filenames.

const path = require('path'); const webpack = require('webpack'); const GlobalizePlugin = require('globalize-webpack-plugin'); module.exports = { entry: './src/index.js', output: { path: path.resolve(__dirname, 'dist'), filename: '[name].js' }, plugins: [ new GlobalizePlugin({ production: process.env.NODE_ENV === 'production', developmentLocale: 'en', supportedLocales: ['en', 'es'], messages: 'messages/[locale].json', output: 'globalize-compiled-[locale].[hash].js' }) ] };
Debug
Known issues
breakingWebpack 4 required from v3.0.0; earlier Webpack versions are not supported.
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.
affects: >=3.0.0
breakingNode.js <4.3.0 dropped in v1.0.0.
fix
Upgrade Node.js to >=4.3.0.
affects: >=1.0.0
deprecatedSupport for webpack 1 ended with v0.x releases.
fix
Migrate to webpack 2+ and use corresponding plugin version.
affects: >=1.0.0
gotchaMust split code into at least three chunks: vendor, globalize-compiled, and application (production only).
fix
Configure entry points to separate vendor libraries (including 'globalize') from application code; plugin will generate globalize-compiled chunks.
affects: all
gotchaPlugin does not work with create-react-app's ModuleScopePlugin without workaround (known issue).
fix
Upgrade to v1.0.1 or later, which includes a fix for compatibility with ModuleScopePlugin.
affects: <1.0.1
gotchaDevelopment mode (production: false) does not precompile formatters; CLDR data must be available at runtime.
fix
Ensure CLDR data is loaded in development or use production mode for precompilation.
affects: all
Errors
Common errors & fixes
Module not found: Can't resolve 'cldr-data' in ...
Missing dependency 'cldr-data'.
fix
Install cldr-data as a dev dependency: npm install cldr-data --save-dev.
Globalize is not defined
Globalize not included in the bundle or not loaded before plugin invocation.
fix
Ensure globalize is included in a vendor chunk and imported in your entry file.
Invalid configuration. 'GlobalizePlugin' is not a valid plugin.
Typo or incorrect instantiation in webpack config.
fix
Check that the plugin is properly required and instantiated: new GlobalizePlugin({ ... }).
globalize-compiled-en.[hash].js chunk not emitted
SupportedLocales not matching any locale in CLDR data or messages.
fix
Verify that the locales listed in supportedLocales exist in your CLDR data and message files.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
cldr-datarequiredCLDR data required at build time for locale support
globalizerequiredCore library for internationalization
iana-tz-dataoptionalTime zone data for date/time formatting
webpackrequiredRequired peer dependency for plugin to work
Agent activity
2 hits · last 30 days
node
2
Resources
globalize-webpack-plugin — npm install globalize-webpack-plugin · libregistry