Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@labor-digital/asset-building-dev-server
Advanced tools
Changelog
Readme
This package is an extension to our asset building bundle.
When it comes to developing Single page applications (SPAs), you will find out sooner or later that it is convenient to have a local dev server that supports stuff like "hot-module-replacement".
The problem with webpack's default dev-server was, it does not work correctly when multiple apps run in the same domain (frontend and backend, for example). It also only works with real "webpack.js" files and not with the dynamic version we use. To circumvent that, and to make the integration as smooth as possible, we created our own dev server using express and webpack's middleware capabilities.
npm install --save-dev @labor-digital/asset-building
npm install --save-dev @labor-digital/asset-building-dev-server
{
"builderVersion": 2,
[...]
"extensions": [
"@labor-digital/asset-building-dev-server"
]
}
"scripts": {
[...]
"dev": "labor-asset-building dev"
}
Our asset builder can run as a middleware in express, providing hot module replacement and webpack's dev features in the same way the "dev" command does for virtually every express app.
We provide a function you can use in your server.js file. It will only apply the required middlewares if your NODE_ENV variable is set to "development".
Register the express plugin in your index.js like:
const expressAssetBuildingPlugin = require("@labor-digital/asset-building/dist/Interop/Express/expressAssetBuildingPlugin.js");
const expressDevServerPlugin = require("@labor-digital/asset-building-dev-server/dist/ExpressDevServerPlugin");
const express = require("express");
const app = express();
// Apply the dev server plugin to the app
expressAssetBuildingPlugin(app)
.then(expressDevServerPlugin)
.then(() => {
// Your express - app setup goes here...
});
By default, the console will show a URL like http://js.localmachine.space:9999 when you are launching a new instance of a project. If you want to change the URL, you can do so by adding the "devUrl" option to your labor configuration in your package.json. The {{port}} placeholder will automatically be replaced with the correct port of your application.
{
[...]
"labor": {
"devUrl": "http://yourUrl:{{port}}"
}
}
To work locally, you can work with an IP like 127.0.0.1, localhost, or you can point a DNS record to your local machine. The localmachine.space domain is precisely that. It is a domain name that always leads to "127.0.0.1", no matter what subdomain you use. Its a helper to make dev URLs more comfortable to read; it works on every machine as long as you have an internet connection.
You're free to use this package, but if it makes it to your production environment, we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: LABOR.digital - Fischtorplatz 21 - 55116 Mainz, Germany.
We publish all received postcards on our company website.
FAQs
An Extension for the LABOR.digital asset-builder, that provides a dev server environment for webpack. Including support for multi-compilers and express
The npm package @labor-digital/asset-building-dev-server receives a total of 37 weekly downloads. As such, @labor-digital/asset-building-dev-server popularity was classified as not popular.
We found that @labor-digital/asset-building-dev-server 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.