Skip to content

Commit

Permalink
remove webpack server options
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga committed Jan 12, 2024
1 parent 0e88bf5 commit 2698590
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
9 changes: 4 additions & 5 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Run Rails & Webpack concurrently
# If you wish to use a different server then the default, use e.g. `export RAILS_STARTUP='puma -w 3 -p 3000 --preload'`
rails: [ -n "$RAILS_STARTUP" ] && env PRY_WARNING=1 $RAILS_STARTUP || [ -n "$BIND" ] && bin/rails server -b $BIND || env PRY_WARNING=1 bin/rails server
# you can use WEBPACK_OPTS to customize webpack server, e.g. 'WEBPACK_OPTS='--https --key /path/to/key --cert /path/to/cert.pem --cacert /path/to/cacert.pem' foreman start '
webpack: [ -n "$NODE_ENV" ] && npx webpack --config config/webpack.config.js --watch $WEBPACK_OPTS || env NODE_ENV=development npx webpack --config config/webpack.config.js --watch
#TODO readme/forklift to change/remove --key to --server-options-key
# --public -> --client-web-socket-url and see why it doesnt work
# --https --> --server-type

# you can use WEBPACK_OPTS to customize webpack server, e.g. 'WEBPACK_OPTS=--analyze' foreman start '
# filter out webpack options that are commonly used but not supported by webpack 5 and not needed in the new configutation as webpack is not run as a server anymore
webpack: FILTERED_WEBPACK_OPTS=$(echo $WEBPACK_OPTS | sed -e 's/--key [^ ]*//g' -e 's/--public [^ ]*//g' -e 's/--https [^ ]*//g' -e 's/--cert [^ ]*//g' -e 's/--cacert [^ ]*//g') && [ -n "$NODE_ENV" ] && npx webpack --config config/webpack.config.js --watch $FILTERED_WEBPACK_OPTS || env NODE_ENV=development npx webpack --config config/webpack.config.js --watch $FILTERED_WEBPACK_OPTS
6 changes: 2 additions & 4 deletions developer_docs/getting-started.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ Following steps are required to setup a webpack development environment:
```
3. **Additional config**
Both `foreman start` and `foreman-start-dev` support `WEBPACK_OPTS` environment variable for passing additional options. This is handy for example when you have development setup with Katello and want to use correct certificates.
Both `foreman start` and `foreman-start-dev` support `WEBPACK_OPTS` environment variable for passing additional options. The webpack build is done for Foreman core and plugins at the same time but seperatly, so options like `--anaylze` that start a server for each build will not work.
An example of such setup:
+
[source,bash]
----
npx webpack \
--config config/webpack.config.js \
--watchOptions-poll 1000 # only use for NFS https://community.theforeman.org/t/webpack-watch-over-nfs/10922
WEBPACK_OPTS='--progress' foreman start webpack
----
+
Additionally you can set `NOTIFICATIONS_POLLING` variable to extend the notification polling interval that is 10s by default and can clutter the console.
Expand Down
2 changes: 1 addition & 1 deletion script/foreman-start-dev
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
npx webpack --config config/webpack.config.js --watch $WEBPACK_OPTS &
FILTERED_WEBPACK_OPTS=$(echo $WEBPACK_OPTS | sed -e 's/--key [^ ]*//g' -e 's/--public [^ ]*//g' -e 's/--https [^ ]*//g' -e 's/--cert [^ ]*//g' -e 's/--cacert [^ ]*//g') && npx webpack --config config/webpack.config.js --watch $FILTERED_WEBPACK_OPTS &
./bin/rails server -b \[::\] "$@"

0 comments on commit 2698590

Please sign in to comment.