Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@americanexpress/holocron-dev-server
Advanced tools
@americanexpress/holocron-dev-server
is an experimental development server
made for One App Holocron modules designed for enabling fast refresh and reloading of assets
while creating web experiences.
⚠️ holocron-dev-server
is a client-side only development server and does not run Holocron modules
as One App would normally. Holocron modules are not loaded into memory on the server, nor does it
server side render (only client side). There are other key differences, and as such, holocron-dev-server
does not behave the same as One App server.
If you are looking for a production-like environment
to run One App Holocron modules, @americanexpress/one-app-runner
would be the right tool of choice. This is because holocron-dev-server
only
provides a faster developer experience on the client side only, without the actual One App server.
"one-amex"
configuration in the package.json
express
server listening for requests: handling request types for navigation, static assets and parrot scenarios, on the same portwebpack
, webpack-dev-middleware
and webpack-hot-middleware
load a configuration for fast refresh, added with react-refresh
via babel
and @pmmmwh/react-refresh-webpack-plugin react-refresh
via webpackmemfs
is synced with unionfs to the filesystem, it connects with webpack dev serving local and remote static assets quickly from memoryPrerequisites
- Docker is required to load One App statics from development environment.
- React Dev tools browser extension is needed in your browser for fast refresh to work
npm install -D @americanexpress/holocron-dev-server
# or
yarn add -D @americanexpress/holocron-dev-server
add the script in the package.json
of your Holocron module:
{
"scripts": {
"dev": "holocron-dev-server"
}
}
then run to start the development server:
npm run dev
# or
yarn dev
Once the command runs, the sandbox Holocron module reload server
will start up using the configuration found in the modules package.json
.
holocron-dev-server
uses existing configurations from "one-amex"
to source what modules, externals and other configuration like
rootModuleName
are used.
The config uses one-amex.runner
(modules
, rootModuleName
, moduleMapUrl
, dockerImage
, envVars
)
and one-amex.bundler
(providedExternals
, requiredExternals
)
to set up the HMR environment for your Holocron module.
In the case that certain configuration options are not present in the Holocron module config, there are default values that are used in its place.
rootModuleName
) will use the current module if it is not defined.dockerImage
) will default to oneamex/one-app-dev:latest
if not defined.If a mock/scenarios.js
exists in your module,
the parrot
scenarios will be watched for changes and updated,
please note that the parrot browser extension will need to be changed to refer
to the port used by the holocron development server.
The same applies if locale/*
folder exists in your Holocron module.
When a given locale gets modified, the holocron dev server will notify the client
and will load the language pack into state.
Please note that if default fallback for loading the language pack is en-US
,
if any issue occurs while trying to load it.
The API is subject to change
holocron-dev-server
Command line tool usage.
npx -p @americanexpress/holocron-dev-server -- holocron-dev-server
hmr
OptionsUse the one-amex.hmr
config for
more advanced configurations. The experimental hmr
config is
subject to change. The options supported are:
name | type | required | default | value |
---|---|---|---|---|
logLevel | Number or String | false | 4 or "info" | "info" or 4 , "log" or 3 , "warn" or 2 , "error" or 1 , 0 for silent |
sourceMap | [Boolean, String] | false | "source-map" | value passed to webpack's devtool configuration (eg inline-cheap-source-map , false ) |
clientConfig | Object | false | {} | the One App configuration in the store (store.get('config') ) |
port | Number | false | 4000 | the port that holocron-dev-server binds to |
openWhenReady | Boolean | false | false | Set to true to enable opening your default browser when ready |
{
"one-amex": {
"hmr": {
"logLevel": "info",
"port": 4000,
"openWhenReady": false,
"sourceMap": "inline-cheap-source-map",
"clientConfig": {
"myClientSideConfig": "https://url"
}
}
}
}
There may be instances where fast refresh may stop working
for various reasons, check out the
troubleshooting guide from @pmmmwh/react-refresh-webpack-plugin react-refresh
for debugging tips.
If any issues persist, try removing the static
directory generated
and run the development server again.
FAQs
A micro-frontend dev server for Holocron Modules
The npm package @americanexpress/holocron-dev-server receives a total of 3 weekly downloads. As such, @americanexpress/holocron-dev-server popularity was classified as not popular.
We found that @americanexpress/holocron-dev-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.