public final class WebpackHandler extends AbstractDevServerRunner
webpack-dev-server
.
This class is meant to be used during developing time. For a production mode
site webpack
generates the static bundles that will be served
directly from the servlet (using a default servlet if such exists) or through
a stand alone static file server.
For internal use only. May be renamed or removed in a future release.
Modifier and Type | Field and Description |
---|---|
static String |
WEBPACK_SERVER
The local installation path of the webpack-dev-server node script.
|
Constructor and Description |
---|
WebpackHandler(Lookup lookup,
int runningPort,
File npmFolder,
CompletableFuture<Void> waitFor)
Creates and starts the dev mode handler if none has been started yet.
|
Modifier and Type | Method and Description |
---|---|
protected File |
getServerBinary()
Gets the binary that starts the dev server.
|
protected File |
getServerConfig()
Gets the main configuration file for the dev server.
|
protected Pattern |
getServerFailurePattern()
Gets a pattern to match with the output to determine that the server has
failed to start.
|
protected String |
getServerName()
Gets the name of the dev server for outputting to the user and
statistics.
|
protected List<String> |
getServerStartupCommand(String nodeExec)
Gets the commands to run to start the dev server.
|
protected Pattern |
getServerSuccessPattern()
Gets a pattern to match with the output to determine that the server has
started successfully.
|
protected void |
onDevServerCompilation(DevServerOutputTracker.Result result)
Called whenever the dev server output matche the success or failure
pattern.
|
protected void |
updateServerStartupEnvironment(FrontendTools frontendTools,
Map<String,String> environment)
Defines the environment variables to use when starting the dev server.
|
checkConnection, doStartDevServer, getApplicationConfiguration, getFailedOutput, getPort, getProjectRoot, getWatchDog, handleRequest, prepareConnection, serveDevModeRequest, stop, triggerLiveReload, validateFiles, waitForDevServer, writeStream
public static final String WEBPACK_SERVER
public WebpackHandler(Lookup lookup, int runningPort, File npmFolder, CompletableFuture<Void> waitFor)
lookup
- the provided lookup to get required datarunningPort
- a port on which webpack is already running or 0 to start a new
processnpmFolder
- folder with npm configuration fileswaitFor
- a completable future whose execution result needs to be
available to start the dev serverprotected void onDevServerCompilation(DevServerOutputTracker.Result result)
AbstractDevServerRunner
onDevServerCompilation
in class AbstractDevServerRunner
protected List<String> getServerStartupCommand(String nodeExec)
AbstractDevServerRunner
getServerStartupCommand
in class AbstractDevServerRunner
nodeExec
- the path to the node binaryprotected void updateServerStartupEnvironment(FrontendTools frontendTools, Map<String,String> environment)
AbstractDevServerRunner
updateServerStartupEnvironment
in class AbstractDevServerRunner
frontendTools
- frontend tools metadataenvironment
- the environment variables to useprotected String getServerName()
AbstractDevServerRunner
getServerName
in class AbstractDevServerRunner
protected File getServerBinary()
AbstractDevServerRunner
getServerBinary
in class AbstractDevServerRunner
protected File getServerConfig()
AbstractDevServerRunner
getServerConfig
in class AbstractDevServerRunner
protected Pattern getServerSuccessPattern()
AbstractDevServerRunner
getServerSuccessPattern
in class AbstractDevServerRunner
protected Pattern getServerFailurePattern()
AbstractDevServerRunner
getServerFailurePattern
in class AbstractDevServerRunner
Copyright © 2024. All rights reserved.