enonic / lib-react4xp

React for XP: handling and rendering of pre-built React components in Enonic XP
Apache License 2.0
2 stars 2 forks source link

Better source code structure #2: source code files anywhere #21

Closed espen42 closed 4 years ago

espen42 commented 4 years ago

Not restricted to react4xp/

espen42 commented 4 years ago

Duplicate of: https://github.com/enonic/starter-react4xp/issues/11

espen42 commented 4 years ago

Solved in lib/package version combination of upcoming v0.6.1 (or above) of starter-react4xp. From the comment in react4xp.properties:


# ENTRIES AND CHUNKING:
# If nothing is added below, this is the default behaviour:
#   - Default entry source folder is /site/, that is: src/main/resources/site/ and its subfolders.
#   - Everything under react4xp root folder (src/main/resources/react4xp/) will be considered chunks and will
#       be bundled by webpack into a single dependency imported by webpack: react4xp.<contenthash>.js
#   - Everything under the react4xp root folder (src/main/resources/react4xp/) will be considered non-entries:
#       added files here can be imported by react4xp entries, but otherwise unreachable from react4xp.
#   - Default entryExtensions (file extensions to look for when finding entries under OTHER entryDirs than /site/) are:
#       jsx, js, tsx, ts, es6, es
#
# chunkDirs are folder names where importable, non-entry code is kept. Comma-separated list of folder names, relative
#       to src/main/resources/react4xp/. Each folder added here will be bundled by webpack into a separate dependency
#       chunk with the same name as the folder, and a hash: <foldername>.<contenthash>.js. This is good for grouping
#       sets of dependencies that belong together, or will frequently be requested from the client together in some parts
#       of a web page but not others, etc. The react4xp root (src/main/resources/react4xp/) is the standard chunk 'react4xp',
#       but you can add subfolders here to bundle them (and their subfolders) in separate chunks. Or you can add relative
#       paths to the react4xp root to imported dependency code from elsewhere. Don't overlap with entryDirs or /site/.
#
# entryDirs are additional folder names where webpack will look for entry files. Comma-separated list of folder names,
#       relative to src/main/resources/react4xp/. By default, react4xp instructs webpack to look for entries under
#       src/main/resources/site/ (and in the react4xp-templates package). Added folders here will be kept out of bundled
#       dependency chunks (take care to avoid directory overlaps with chunkDirs) and treated separately. Files in
#       them will be compiled into react4xp entries, which most importantly get a jsxPath (relative to their entryDir, not
#       relative to /react4xp/) and therefore are available to react4xp.
#
# entryExtensions are filename extensions of files (comma-separated list) below the entryDirs folders that webpack should
#       look for and turn into entries. NOTE that this doesn't apply to the default entry-folder src/main/resources/site/
#       (or the react4xp-templates package), where ONLY .jsx (and .tsx) files can be entries. This is to avoid mixups with
#       XP controllers etc, which can be .js or .es6. Default value if not changed is jsx,js,tsx,ts,es6,es. Also note that
#       tsx/ts files are NOT supported out of the box. Rules for typescript compilation must be added in your own
#       overrideComponentWebpack file (see above).
chunkDirs =
entryDirs =
entryExtensions =