Webpack: Reduce to one entrypoint, app/application.js

stable/1.0.x
Alex Gleason 2020-05-28 18:46:24 -05:00
rodzic badd64571f
commit da3e63596b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
4 zmienionych plików z 12 dodań i 23 usunięć

10
app/application.js 100644
Wyświetl plik

@ -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);
});

Wyświetl plik

@ -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);
});

Wyświetl plik

@ -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

Wyświetl plik

@ -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);