
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
react4xp-build-components
Advanced tools
React4xp helper: basic webpack compilation of user-added React components in a React4xp structure
React4xp compile-time, used by a an Enonic XP root project.
Supplies a webpack setup that:
src/main/resources/site/,node_modules/react4xp-regions (see react4xp-regions),entryDirs and chunkDirs in the root project's file react4xp.properties,build/resources/main/assets/react4xp/*entries.jsonstats.components.jsonThis webpack setup is minimal by design. If you want to replace or modify it to inject your own react-compilation rules, plugins etc,, use OVERRIDE_COMPONENT_WEBPACK or overrideComponentWebpack (see below).
Not really intended for separate installation or use! Part of the react4xp NPM bundle. Better start with the React4xp introduction.
The webpack config takes one or more CLI arguments. These are one the form of --env.X=Y, where X is any of the capital-letter keys below (X is the parameter name, Y is the value, usually a string - but if it's an object then Y is expected to be a valid JSON string)
The usual caveat about these parameters: these are among a set of working default values that come from react4xp-buildconstants, where all the parameters have the same name as below (and are better described!). The values can be changed as parameters to react4xp-build-components, but apart from the mandatory REACT4XP_CONFIG_FILE, it's recommended to override these parameters in react4xp-buildconstants instead. Use the same-name input parameters there. That will affect the general config file instead of only this package's behavior, the rest is handled for you (as long as you use the gradle setup from the starter, see for example the gradle-basic-setup section in the README of lib-react4xp).
First, note that in the standard setup in the react4xp starter (or similar setups), the most commonly changed values stem directly from the react4xp.properties file. It's way easier to handle these values here (but that depends on the gradle setup. If that doesn't work for you, just use them the same way, but with the capital-letter env keys below).
entryDirs: additional folder names where webpack will look for entry files.
src/main/resources/react4xp/.src/main/resources/site/ and in the react4xp-regions package - and ENTRY_DIRS is used to add more folder paths to these. Since these folder paths are relative, entries can also be put outside of the react4xp root if you want.chunkDirs: folder names where source code is kept, that can be imported by entries.
src/main/resources/react4xp/ (can be outside that root too, just avoid overlapping with ENTRY_DIRS, src/main/resources/site/ and anything under those).<foldername>.<contenthash>.js.src/main/resources/react4xp/, and node_modules. Anything imported into entries from folders below these (and not specified in CHUNK_DIRS) will be chunked into the default chunks: react4xp.<contenthash>.js and vendors.<contenthash>.js, respectively.src/main/resources/site/ is treated as a default ENTRY_DIR. Any JSX code below this folder, even if it's just an imported dependency, will be interpreted as an entry. Luckily, entries can import other entries, so this will work fine. But you won't get the chunking optimization.overrideComponentWebpack: root-project-relative path to an optional JS file that modifies or replaces the webpack config.
(env, config) arg pair, and must return a webpack config object.env is webpack environmentconfig is the webpack config object from react4xp-build-components.config, or a new webpack config object.buildEnv: "production" or "development". Actually, any other value than "production" enables dev mode. Controls asset uglification etc.
verbose: "true", or any other value/missing for false. Produces more output during build.
REACT4XP_CONFIG_FILE: root-project-relative path to a react4xp-project constant-values JSON file.
SRC_R4X, BUILD_R4X, SRC_SITE, LIBRARY_NAME, EXTERNALS, COMPONENT_STATS_FILENAME, CHUNK_CONTENTHASH, ENTRIES_FILENAME.ROOT: absolute path to the root projectThese are the same as the camel-case properties under react4xp.properties above:
OVERRIDE_COMPONENT_WEBPACK: see overrideComponentWebpackENTRY_DIRS: see entryDirsCHUNK_DIRS: see chunkDirsBUILD_ENV: see buildEnvVERBOSE: see verboseFAQs
React4xp helper: basic webpack compilation of user-added React components in a React4xp structure
The npm package react4xp-build-components receives a total of 11 weekly downloads. As such, react4xp-build-components popularity was classified as not popular.
We found that react4xp-build-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.