webpack.renderer.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132
  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 path = require('path');
  6. const merge = require('webpack-merge');
  7. const CopyWebpackPlugin = require('copy-webpack-plugin');
  8. const HtmlWebpackPlugin = require('html-webpack-plugin');
  9. const baseConfig = require('@polkadot/apps/webpack.base.config');
  10. const ENV = process.env.NODE_ENV || 'production';
  11. const isProd = ENV === 'production';
  12. const context = __dirname;
  13. module.exports = merge(
  14. baseConfig(ENV, context),
  15. {
  16. devtool: isProd ? 'none' : 'source-map',
  17. plugins: [
  18. // It must be placed before HtmlWebpackPlugin
  19. new CopyWebpackPlugin({ patterns: [{ from: '../apps/public' }] }),
  20. new HtmlWebpackPlugin({
  21. PAGE_TITLE: 'Polkadot/Substrate Portal',
  22. inject: true,
  23. template: path.join(context, '../apps/public/index.html')
  24. })
  25. ],
  26. target: 'web'
  27. }
  28. );