Skip to content

Commit

Permalink
Decrease chart.js bytes (#1368)
Browse files Browse the repository at this point in the history
* remove 'chartjs' dependency (typo of 'chart.js')

* don't load data for unsupported locales

* don't escape unnecessarily
  • Loading branch information
geppy authored Feb 19, 2019
1 parent 9aab4a7 commit dd17384
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion client/app/stories/Chart.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'chartjs';
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Chart } from '../components/Chart';
Expand Down
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"axios": "^0.18.0",
"babel-core": "7.0.0-bridge.0",
"chart.js": "^2.6.0",
"chartjs": "^0.3.24",
"chartkick": "^2.2.4",
"es5-shim": "^4.5.9",
"font-awesome": "^4.7.0",
Expand Down
3 changes: 3 additions & 0 deletions client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ManifestPlugin = require('webpack-manifest-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const baseConfig = require('./webpack.config.base');

const configPath = resolve('..', 'config');
Expand Down Expand Up @@ -99,6 +100,8 @@ const config = Object.assign(baseConfig, {
hot: !!devOrTestMode,
}),
new ManifestPlugin({ publicPath: output.publicPath, writeToFileEmit: true }),
// only load moment.js data for locales we support (see config/locale.rb)
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en|es|de|it|nb|nl|pt-BR|sv|vi|fr/),
],

module: {
Expand Down
5 changes: 0 additions & 5 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2762,11 +2762,6 @@ chartjs-color@^2.1.0:
chartjs-color-string "^0.5.0"
color-convert "^0.5.3"

chartjs@^0.3.24:
version "0.3.24"
resolved "https://registry.yarnpkg.com/chartjs/-/chartjs-0.3.24.tgz#3addeb5ae3606b3e89e346c27d52ca158416e93d"
integrity sha1-Ot3rWuNgaz6J40bCfVLKFYQW6T0=

chartkick@^2.2.4:
version "2.3.6"
resolved "https://registry.yarnpkg.com/chartkick/-/chartkick-2.3.6.tgz#a507c54da7d117e66c9a9c5309f7ecccc2d28b51"
Expand Down

0 comments on commit dd17384

Please sign in to comment.