From da3e63596b0d105ad348d83e891da350a16b58d8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 28 May 2020 18:46:24 -0500 Subject: [PATCH] Webpack: Reduce to one entrypoint, app/application.js --- app/application.js | 10 ++++++++++ app/packs/application.js | 10 ---------- webpack/config/webpacker.yml | 1 - webpack/shared.js | 14 ++------------ 4 files changed, 12 insertions(+), 23 deletions(-) create mode 100644 app/application.js delete mode 100644 app/packs/application.js diff --git a/app/application.js b/app/application.js new file mode 100644 index 000000000..906247ea3 --- /dev/null +++ b/app/application.js @@ -0,0 +1,10 @@ +import loadPolyfills from './soapbox/load_polyfills'; +import { start } from './soapbox/common'; + +start(); + +loadPolyfills().then(() => { + require('./soapbox/main').default(); +}).catch(e => { + console.error(e); +}); diff --git a/app/packs/application.js b/app/packs/application.js deleted file mode 100644 index f43e4d05e..000000000 --- a/app/packs/application.js +++ /dev/null @@ -1,10 +0,0 @@ -import loadPolyfills from '../soapbox/load_polyfills'; -import { start } from '../soapbox/common'; - -start(); - -loadPolyfills().then(() => { - require('../soapbox/main').default(); -}).catch(e => { - console.error(e); -}); diff --git a/webpack/config/webpacker.yml b/webpack/config/webpacker.yml index e9834ba2a..6190d7184 100644 --- a/webpack/config/webpacker.yml +++ b/webpack/config/webpacker.yml @@ -2,7 +2,6 @@ default: &default source_path: app - source_entry_path: packs public_root_path: static public_output_path: packs cache_path: tmp/cache/webpacker diff --git a/webpack/shared.js b/webpack/shared.js index ef9c54d7d..740c33f22 100644 --- a/webpack/shared.js +++ b/webpack/shared.js @@ -1,8 +1,7 @@ // Note: You must restart bin/webpack-dev-server for changes to take effect const webpack = require('webpack'); -const { basename, dirname, join, relative, resolve } = require('path'); -const { sync } = require('glob'); +const { basename, join, resolve } = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const AssetsManifestPlugin = require('webpack-assets-manifest'); const HtmlWebpackPlugin = require('html-webpack-plugin'); @@ -12,18 +11,9 @@ const { env, settings, themes, output } = require('./configuration'); const rules = require('./rules'); const localePackPaths = require('./generateLocalePacks'); -const extensionGlob = `**/*{${settings.extensions.join(',')}}*`; -const entryPath = join(settings.source_path, settings.source_entry_path); -const packPaths = sync(join(entryPath, extensionGlob)); - module.exports = { entry: Object.assign( - packPaths.reduce((map, entry) => { - const localMap = map; - const namespace = relative(join(entryPath), dirname(entry)); - localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry); - return localMap; - }, {}), + { application: resolve('app/application.js') }, localePackPaths.reduce((map, entry) => { const localMap = map; localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry);