ts_webpack.conf 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. WEBPACK_CONFIG_PATH=webpack.config.js
  2. ### @usage: TS_WEBPACK_CONFIG(ConfigPath)
  3. ###
  4. ### Macro sets the config path for TS_WEBPACK module.
  5. ###
  6. ### - ConfigPath - config path
  7. ###
  8. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_WEBPACK#ts-webpack-config
  9. macro TS_WEBPACK_CONFIG(ConfigPath) {
  10. SET(WEBPACK_CONFIG_PATH $ConfigPath)
  11. }
  12. WEBPACK_OUTPUT_DIR=bundle
  13. ### @usage: TS_WEBPACK_OUTPUT(FirstDirName DirNames)
  14. ###
  15. ### Macro sets the output directory names (one at least) for TS_WEBPACK module.
  16. ###
  17. ### - DirNames - output directory names (one at least)
  18. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_WEBPACK#ts-webpack-output
  19. macro TS_WEBPACK_OUTPUT(FirstDirName, DirNames...) {
  20. SET(WEBPACK_OUTPUT_DIR $FirstDirName $DirNames)
  21. }
  22. # TODO: remove me: https://st.yandex-team.ru/FBP-1678
  23. # tag:deprecated
  24. macro WEBPACK_OUTPUT(FirstDirName, DirNames...) {
  25. MESSAGE(WARNING "WEBPACK_OUTPUT is deprecated, use TS_WEBPACK_OUTPUT instead")
  26. SET(WEBPACK_OUTPUT_DIR $FirstDirName $DirNames)
  27. }
  28. TS_WEBPACK_CMD=$TOUCH_UNIT \
  29. && $_TS_FILES_COPY_CMD \
  30. && $ADD_VCS_INFO_FILE_CMD \
  31. && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-webpack $NOTS_TOOL_COMMON_BUILDER_ARGS \
  32. --bundler-config-path ${input:WEBPACK_CONFIG_PATH} \
  33. --output-dirs ${WEBPACK_OUTPUT_DIR} \
  34. $_NODE_MODULES_INOUTS ${hide:PEERS} \
  35. ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
  36. ${output;hide:"package.json"} \
  37. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_WPK"}
  38. ### @usage: TS_WEBPACK([name])
  39. ###
  40. ### The Webpack bundle, bundles JavaScript code.
  41. ### Build results are packed as `output.tar`.
  42. ###
  43. ### Documentation: https://docs.yandex-team.ru/frontend-in-arcadia/references/TS_WEBPACK
  44. ###
  45. ### @example
  46. ###
  47. ### TS_WEBPACK()
  48. ### END()
  49. ###
  50. multimodule TS_WEBPACK {
  51. module BUILD: _TS_BASE_UNIT {
  52. .CMD=TS_WEBPACK_CMD
  53. .EPILOGUE=_TS_CONFIG_EPILOGUE
  54. .PEERDIRSELF=TS_PREPARE_DEPS
  55. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  56. # but we have to set it to TS for include processor to work
  57. SET(MODULE_TAG TS)
  58. SET(MODULE_LANG TS)
  59. _PEERDIR_TS_RESOURCE(webpack webpack-cli)
  60. DISABLE(TS_CONFIG_DEDUCE_OUT)
  61. DISABLE(TS_CONFIG_USE_OUTDIR)
  62. _TS_CONFIGURE()
  63. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
  64. _TS_ADD_NODE_MODULES_FOR_BUILDER()
  65. }
  66. module TS_PREPARE_DEPS: _PREPARE_DEPS_BASE {
  67. }
  68. }