Webpack: Reduce to one entrypoint, app/application.js
This commit is contained in:
parent
badd64571f
commit
da3e63596b
4 changed files with 12 additions and 23 deletions
10
app/application.js
Normal file
10
app/application.js
Normal file
|
@ -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);
|
||||||
|
});
|
|
@ -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);
|
|
||||||
});
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
default: &default
|
default: &default
|
||||||
source_path: app
|
source_path: app
|
||||||
source_entry_path: packs
|
|
||||||
public_root_path: static
|
public_root_path: static
|
||||||
public_output_path: packs
|
public_output_path: packs
|
||||||
cache_path: tmp/cache/webpacker
|
cache_path: tmp/cache/webpacker
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Note: You must restart bin/webpack-dev-server for changes to take effect
|
// Note: You must restart bin/webpack-dev-server for changes to take effect
|
||||||
|
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const { basename, dirname, join, relative, resolve } = require('path');
|
const { basename, join, resolve } = require('path');
|
||||||
const { sync } = require('glob');
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const AssetsManifestPlugin = require('webpack-assets-manifest');
|
const AssetsManifestPlugin = require('webpack-assets-manifest');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
@ -12,18 +11,9 @@ const { env, settings, themes, output } = require('./configuration');
|
||||||
const rules = require('./rules');
|
const rules = require('./rules');
|
||||||
const localePackPaths = require('./generateLocalePacks');
|
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 = {
|
module.exports = {
|
||||||
entry: Object.assign(
|
entry: Object.assign(
|
||||||
packPaths.reduce((map, entry) => {
|
{ application: resolve('app/application.js') },
|
||||||
const localMap = map;
|
|
||||||
const namespace = relative(join(entryPath), dirname(entry));
|
|
||||||
localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry);
|
|
||||||
return localMap;
|
|
||||||
}, {}),
|
|
||||||
localePackPaths.reduce((map, entry) => {
|
localePackPaths.reduce((map, entry) => {
|
||||||
const localMap = map;
|
const localMap = map;
|
||||||
localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry);
|
localMap[basename(entry, extname(entry, extname(entry)))] = resolve(entry);
|
||||||
|
|
Loading…
Reference in a new issue