1
0

configuration.js 749 B

123456789101112131415161718192021222324252627
  1. // Common configuration for webpacker loaded from config/webpacker.yml
  2. const { resolve } = require('path');
  3. const { env } = require('process');
  4. const { load } = require('js-yaml');
  5. const { readFileSync } = require('fs');
  6. const configPath = resolve('config', 'webpacker.yml');
  7. const settings = load(readFileSync(configPath), 'utf8')[env.RAILS_ENV || env.NODE_ENV];
  8. const themePath = resolve('config', 'themes.yml');
  9. const themes = load(readFileSync(themePath), 'utf8');
  10. const output = {
  11. path: resolve('public', settings.public_output_path),
  12. publicPath: `/${settings.public_output_path}/`,
  13. };
  14. module.exports = {
  15. settings,
  16. themes,
  17. env: {
  18. NODE_ENV: env.NODE_ENV,
  19. PUBLIC_OUTPUT_PATH: settings.public_output_path,
  20. },
  21. output,
  22. };