Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary moment.js locales from bundle #537

Merged
merged 2 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"jsdom": "^9.2.1",
"mkdirp": "^0.5.1",
"mocha": "2.4.5",
"moment-locales-webpack-plugin": "^1.1.2",
"nock": "^8.0.0",
"node-sass": "4.9.4",
"npm-run-all": "3.1.2",
Expand Down
8 changes: 6 additions & 2 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import webpack from 'webpack';
import path from 'path';
import { ADMIN_PREFIX } from './src/constants';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
import { ADMIN_PREFIX } from './src/constants';

const GLOBALS = {
'process.env.NODE_ENV': JSON.stringify('development'),
Expand Down Expand Up @@ -41,7 +42,10 @@ export default {
analyzerMode: 'static',
logLevel: 'silent',
openAnalyzer: false
})
}),
// Strip all moment.js locales except "en" ("en" is built into Moment and can't be removed)
// Refer https://github.com/iamakulov/moment-locales-webpack-plugin for options that can be passed
new MomentLocalesPlugin(),
],
module: {
rules: [
Expand Down
6 changes: 5 additions & 1 deletion webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import webpack from 'webpack';
import path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
import { ADMIN_PREFIX } from './src/constants';

const GLOBALS = {
Expand Down Expand Up @@ -33,7 +34,10 @@ export default {
},
context: '/'
}
})
}),
// Strip all moment.js locales except "en" ("en" is built into Moment and can't be removed)
// Refer https://github.com/iamakulov/moment-locales-webpack-plugin for options that can be passed
new MomentLocalesPlugin(),
],
module: {
rules: [
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5510,6 +5510,11 @@ lodash.defaults@^4.0.1:
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=

lodash.difference@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.difference/-/lodash.difference-4.5.0.tgz#9ccb4e505d486b91651345772885a2df27fd017c"
integrity sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=

lodash.filter@^4.4.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.filter/-/lodash.filter-4.6.0.tgz#668b1d4981603ae1cc5a6fa760143e480b4c4ace"
Expand Down Expand Up @@ -5942,6 +5947,13 @@ mocha@2.4.5:
mkdirp "0.5.1"
supports-color "1.2.0"

moment-locales-webpack-plugin@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/moment-locales-webpack-plugin/-/moment-locales-webpack-plugin-1.1.2.tgz#9ae5263ac38d5cba227fc9d76efad025bb685a0c"
integrity sha512-s+JE7lADQjUyeQvqB3sVcfxXncg1o+t5hrRl2GBY66vXuLO2tXIjD+4mNUXQMS10qCGoeK3R3skBrW34gHobBQ==
dependencies:
lodash.difference "^4.5.0"

moment@2.24.0:
version "2.24.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
Expand Down