webpack.config.js 948 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2017-2020 @polkadot/apps authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. /* eslint-disable camelcase */
  5. const fs = require('fs');
  6. const path = require('path');
  7. const merge = require('webpack-merge');
  8. const baseConfig = require('./webpack.base.config');
  9. const HtmlWebpackPlugin = require('html-webpack-plugin');
  10. const ENV = process.env.NODE_ENV || 'development';
  11. const context = __dirname;
  12. const hasPublic = fs.existsSync(path.join(context, 'public'));
  13. module.exports = merge(
  14. baseConfig(ENV, context),
  15. {
  16. devtool: process.env.BUILD_ANALYZE ? 'source-map' : false,
  17. plugins: [
  18. new HtmlWebpackPlugin({
  19. IS_PROD: ENV === 'production',
  20. PAGE_TITLE: 'Joystream Network Portal',
  21. inject: true,
  22. template: path.join(context, `${hasPublic ? 'public/' : ''}index.html`)
  23. })
  24. ]
  25. }
  26. );