webpack.gni 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import("../npm.gni")
  2. template("webpack_build") {
  3. assert(defined(invoker.config_file), "Need webpack config file to run")
  4. assert(defined(invoker.out_file), "Need output file to run")
  5. assert(defined(invoker.inputs), "Need webpack inputs to run")
  6. npm_action(target_name) {
  7. forward_variables_from(invoker,
  8. [
  9. "deps",
  10. "public_deps",
  11. ])
  12. script = "webpack"
  13. inputs = [
  14. invoker.config_file,
  15. "//electron/build/webpack/webpack.config.base.js",
  16. "//electron/tsconfig.json",
  17. "//electron/yarn.lock",
  18. "//electron/typings/internal-ambient.d.ts",
  19. "//electron/typings/internal-electron.d.ts",
  20. ] + invoker.inputs
  21. mode = "development"
  22. if (is_official_build) {
  23. mode = "production"
  24. }
  25. args = [
  26. "--config",
  27. rebase_path(invoker.config_file),
  28. "--output-filename=" + get_path_info(invoker.out_file, "file"),
  29. "--output-path=" + rebase_path(get_path_info(invoker.out_file, "dir")),
  30. "--env.buildflags=" +
  31. rebase_path("$target_gen_dir/buildflags/buildflags.h"),
  32. "--env.mode=" + mode,
  33. ]
  34. deps += [ "//electron/buildflags" ]
  35. outputs = [ invoker.out_file ]
  36. }
  37. }