-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.js
29 lines (25 loc) · 894 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"use strict";
const DevelopmentModePlugin = require("./DevelopmentModePlugin");
const ProductionModePlugin = require("./ProductionModePlugin");
/**
* Development Mode:
* - Automatically loads CLDR data (i.e., injects `Globalize.load(<necessary CLDR data>)`).
* - Automatically define default locale (i.e., injects `Globalize.locale(<defaultLocale>)`).
*
* Production Mode:
* - Have Globalize modules replaced with their runtime modules.
* - Statically extracts formatters and parsers from user code and pre-compile
* them into respective XXXX.
*/
class GlobalizePlugin {
constructor(attributes) {
this.attributes = attributes || {};
}
apply(compiler) {
const plugin = this.attributes.production ?
new ProductionModePlugin(this.attributes) :
new DevelopmentModePlugin(this.attributes);
plugin.apply(compiler);
}
}
module.exports = GlobalizePlugin;