diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js index 08845112b3..313721c88d 100644 --- a/app/javascript/mastodon/main.js +++ b/app/javascript/mastodon/main.js @@ -17,11 +17,8 @@ function main() { const Mastodon = require('mastodon/containers/mastodon').default; const React = require('react'); const ReactDOM = require('react-dom'); - const Rails = require('rails-ujs'); window.Perf = require('react-addons-perf'); - Rails.start(); - require.context('../images/', true); // import customization styles diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js new file mode 100644 index 0000000000..9d63d8f982 --- /dev/null +++ b/app/javascript/packs/common.js @@ -0,0 +1,2 @@ +import { start } from 'rails-ujs'; +start(); diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index bbeb0a9ecf..6aef2ffeef 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -3,12 +3,9 @@ import { length } from 'stringz'; import { default as dateFormat } from 'date-fns/format'; import distanceInWordsStrict from 'date-fns/distance_in_words_strict'; import { delegate } from 'rails-ujs'; -import Rails from 'rails-ujs'; require.context('../images/', true); -Rails.start(); - const parseFormat = (format) => format.replace(/%(\w)/g, (_, modifier) => { switch (modifier) { case '%': diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 73fab9a5c4..21590ae3cc 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -18,9 +18,8 @@ = ' - ' = title - = stylesheet_pack_tag 'vendor', media: 'all' = stylesheet_pack_tag 'application', media: 'all' - = javascript_pack_tag 'vendor', integrity: true, crossorigin: 'anonymous' + = javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous' = csrf_meta_tags = yield :header_tags diff --git a/config/webpack/shared.js b/config/webpack/shared.js index ef9feaeba7..0082188081 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -40,8 +40,8 @@ module.exports = { new ExtractTextPlugin(env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css'), new ManifestPlugin({ fileName: paths.manifest, publicPath, writeToFileEmit: true }), new webpack.optimize.CommonsChunkPlugin({ - name: 'vendor', - minChunks: ({ resource }) => /node_modules/.test(resource) + name: 'common', + minChunks: 2 }) ],