webpack.tunnel.js 666 B

123456789101112131415161718192021222324
  1. const path = require('path');
  2. const { merge } = require('webpack-merge');
  3. const common = require('./webpack.common.js');
  4. const LocaltunnelPlugin = require('localtunnel-webpack-plugin');
  5. const prefix =
  6. process.env.TUNNEL_PREFIX || Math.random().toString().substr(2, 8);
  7. module.exports = merge(common, {
  8. mode: 'development',
  9. watchOptions: {
  10. ignored: ['node_modules/**'],
  11. },
  12. devServer: {
  13. contentBase: path.join(__dirname, 'dist'),
  14. public: prefix + '-ricochet.loca.lt',
  15. compress: true,
  16. allowedHosts: ['.loca.lt'],
  17. port: 9000,
  18. },
  19. plugins: [
  20. new LocaltunnelPlugin({ localtunnel: { subdomain: prefix + '-ricochet' } }),
  21. ],
  22. });