ts_webpack.conf 2.2 KB

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