Skip to content

Commit fe5a987

Browse files
committed
minor #592 [Webpack/Moment] Include all moment locales (yceruto, javiereguiluz)
This PR was merged into the master branch. Discussion ---------- [Webpack/Moment] Include all moment locales This resolves #591 if someone else can confirm the same error. The `admin.js` file size in production increases to `227k` (from `178k`) The locale list comes from `config.yml`: ```yaml parameters: # This parameter defines the codes of the locales (languages) enabled in the application app_locales: en|fr|de|es|cs|nl|ru|uk|ro|pt_BR|pl|it|ja|id|ca|sl|hr|zh_CN ``` Commits ------- 1818ab4 Removed an unneeded variable 774a4b8 [Webpack/Moment] Include all moment locales 0726e00 [Webpack/Moment] Include used locales only
2 parents bf48560 + 1818ab4 commit fe5a987

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/AppBundle/Form/Type/DateTimePickerType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(MomentFormatConverter $converter)
4141
public function buildView(FormView $view, FormInterface $form, array $options)
4242
{
4343
$view->vars['attr']['data-date-format'] = $this->formatConverter->convert($options['format']);
44-
$view->vars['attr']['data-date-locale'] = \Locale::getDefault();
44+
$view->vars['attr']['data-date-locale'] = mb_strtolower(strtr(\Locale::getDefault(), '_', '-'));
4545
}
4646

4747
/**

webpack.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var Encore = require('@symfony/webpack-encore');
2-
var webpack = require('webpack');
32

43
Encore
54
.setOutputPath('web/build/')
@@ -21,8 +20,4 @@ Encore
2120
.addStyleEntry('css/admin', ['./app/Resources/assets/scss/admin.scss'])
2221
;
2322

24-
var config = Encore.getWebpackConfig();
25-
26-
config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
27-
28-
module.exports = config;
23+
module.exports = Encore.getWebpackConfig();

0 commit comments

Comments
 (0)