mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-21 04:39:23 +00:00
4c45b43cb8
* Change how CDN_HOST is passed down to make assets build reproducible * Change webpacker/webpack configuration to dynamically load publicPath based on meta header * Fix embedded layout missing the cdn-host meta header
28 lines
761 B
JavaScript
28 lines
761 B
JavaScript
// Common configuration for webpacker loaded from config/webpacker.yml
|
|
|
|
const { resolve } = require('path');
|
|
const { env } = require('process');
|
|
const { safeLoad } = require('js-yaml');
|
|
const { readFileSync } = require('fs');
|
|
|
|
const configPath = resolve('config', 'webpacker.yml');
|
|
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.RAILS_ENV || env.NODE_ENV];
|
|
|
|
const themePath = resolve('config', 'themes.yml');
|
|
const themes = safeLoad(readFileSync(themePath), 'utf8');
|
|
|
|
const output = {
|
|
path: resolve('public', settings.public_output_path),
|
|
publicPath: `/${settings.public_output_path}/`,
|
|
};
|
|
|
|
module.exports = {
|
|
settings,
|
|
themes,
|
|
env: {
|
|
NODE_ENV: env.NODE_ENV,
|
|
PUBLIC_OUTPUT_PATH: settings.public_output_path,
|
|
},
|
|
output,
|
|
};
|