webpack.tunnel.js 720 B

12345678910111213141516171819202122232425
  1. import path from "path";
  2. import { merge } from "webpack-merge";
  3. import common from "./webpack.common.js";
  4. import LocalTunnelPlugin from "webpack-plugin-localtunnel";
  5. import { fileURLToPath } from "url";
  6. const dirname = path.dirname(fileURLToPath(import.meta.url));
  7. const prefix =
  8. process.env.TUNNEL_PREFIX || Math.random().toString().substring(2, 10);
  9. export default merge(common, {
  10. mode: "development",
  11. watchOptions: {
  12. ignored: ["node_modules/**"],
  13. },
  14. devServer: {
  15. contentBase: path.join(dirname, "dist"),
  16. public: prefix + "-ricochet.loca.lt",
  17. compress: true,
  18. allowedHosts: [".loca.lt"],
  19. port: 9000,
  20. },
  21. plugins: [new LocalTunnelPlugin({ subdomain: prefix + "-ricochet" })],
  22. });