webpack.config.js 910 B

1234567891011121314151617181920212223242526272829
  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. PAGE_TITLE: 'Polkadot/Substrate Portal',
  20. inject: true,
  21. template: path.join(context, `${hasPublic ? 'public/' : ''}index.html`)
  22. })
  23. ]
  24. }
  25. );