ts_webpack.conf 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. WEBPACK_OUTPUT_DIR=bundle
  2. WEBPACK_CONFIG_PATH=webpack.config.js
  3. TS_WEBPACK_CMD=$TOUCH_UNIT \
  4. && $_TS_FILES_COPY_CMD \
  5. && $ADD_VCS_INFO_FILE_CMD \
  6. && $NOTS_TOOL $NOTS_TOOL_BASE_ARGS build-webpack $NOTS_TOOL_COMMON_BUILDER_ARGS \
  7. --bundler-config-path ${input:WEBPACK_CONFIG_PATH} \
  8. --output-dir ${WEBPACK_OUTPUT_DIR} \
  9. $_NODE_MODULES_INOUTS ${hide:PEERS} \
  10. ${input;hide:"package.json"} ${TS_CONFIG_FILES} $_AS_HIDDEN_INPUTS(IN $TS_INPUT_FILES) \
  11. ${output;hide:"package.json"} \
  12. ${kv;hide:"pc magenta"} ${kv;hide:"p TS_WPK"}
  13. ### @usage: WEBPACK_OUTPUT(DirName)
  14. ###
  15. ### Macro sets the output directory name for TS_WEBPACK module.
  16. ###
  17. ### - DirName - output directory name ("bundle" by default).
  18. macro WEBPACK_OUTPUT(DirName) {
  19. SET(WEBPACK_OUTPUT_DIR $DirName)
  20. }
  21. ### @usage: TS_WEBPACK([name])
  22. ###
  23. ### The Webpack bundle, bundles JavaScript code.
  24. ### Build results are packed as `output.tar`.
  25. ###
  26. ### @example
  27. ###
  28. ### TS_WEBPACK()
  29. ### END()
  30. ###
  31. multimodule TS_WEBPACK {
  32. module BUILD: _TS_BASE_UNIT {
  33. .CMD=TS_WEBPACK_CMD
  34. .EPILOGUE=_TS_CONFIG_EPILOGUE
  35. # by default multimodule overrides inherited MODULE_TAG to submodule name (BUILD in this case)
  36. # but we have to set it to TS for include processor to work
  37. SET(MODULE_TAG TS)
  38. _PEERDIR_TS_RESOURCE(webpack webpack-cli)
  39. DISABLE(TS_CONFIG_DEDUCE_OUT)
  40. DISABLE(TS_CONFIG_USE_OUTDIR)
  41. _TS_CONFIGURE($TS_CONFIG_PATH)
  42. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${CURDIR}/package.json ${CURDIR}/pnpm-lock.yaml ${CURDIR}/${TS_CONFIG_PATH})
  43. _TS_ADD_NODE_MODULES_FOR_BUILDER()
  44. }
  45. }