
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
Build tool to enhance React based SPAs with SSR and frontend micro-services architecture
npm init webshift@latest <working-dir>
==>
../
βββ src/
β βββ ...
β βββ App.js
βββ package.json
βββ webshift.config.js
- Bundles ./src/App.js into memory with webpack-dev-middleware
- Provides Hot Module Replacement with webpack-hot-middleware
npm start
- Bundles ./src/App.js into the ./build folder
- Optimizes artifacts and includes hashes into filenames
npm run build && npm run build:start
==>
../
βββ build/
β βββ analyse/ <-- bundle details (size, dependencies)
β βββ public/ <-- www folder
β β βββ img/ <-- bunle images
β β βββ js/ <-- client scripts
β β β βββ main.js <-- main entry
β β β βββ [name].[chunkhash].js <-- code splitting chunks
β β β βββ vendor.js <-- application dependencies
β βββ server.js <-- node express server
β βββ stats.json <-- chunks to assets map
Split client code for better web performance
import { Route, Switch } from 'react-router';
import { Link } from 'react-router-dom';
import loadable from '@loadable/component';
export default (props) => {
const Welcome = loadable(() => import('./Welcome'));
const Aboutus = loadable(() => import('./Aboutus'));
const Error = loadable(() => import('./Error'));
return (
<Layout>
<Link to="/">Welcome</Link>
<Link to="/about">About Us</Link>
<Switch>
<Route path={ '/' } component={ Welcome } />
<Route path={ '/about' } component={ Aboutus } />
<Route component={ Error } />
</Switch>
</Layout>
);
};
Fetching data on the server.
Fetch library should be universal e.g. axios
import axios from 'axios';
import { useServerSideEffect } from 'webshift';
const MyComponent = () => {
const [data, error] = useServerSideEffect('key', () => {
return axios.get("https://myapi.example.com").then((res) => res.data);
}, []);
return <div>{data.title}</div>;
};
import { useLogger } from 'webshift';
const MyComponent = () => {
const logger = useLogger();
logger.verbose({message: "[Render]", meta: { component: 'MyComponent'}});
return <div>Some Text</div>;
};
Edit ./webshift.config.js to customise bundle
module.exports = {
common: {
resolve: {
alias: {
'@app': `${ process.cwd() }/src/App.js`,
},
},
},
client: {
resolve: {
alias: {
'@logger': `${__dirname}/client/logger.js`,
},
},
externals: [
"react",
"react-dom",
"react-router",
"react-router-dom",
],
},
server: {
resolve: {
alias: {
'@render': `${__dirname}/server/render.js`,
'@core': `${__dirname}/server/core.js`,
'@document': `${__dirname}/server/document.js`,
'@logger': `${__dirname}/server/logger.js`,
},
},
}
};
# Webserver and assets
NODE_ENV=[production|development]
HOST=localhost
PORT=3040
PUBLIC_PATH=/main/
BASE_PATH=
# Application logging
LOG_LEVEL=[info|http|verbose|debug]
LOG_TYPE=[json|message]
- Clone the repository
- npm install
- npm run build:init
- npm run build:copy
- cd build/
- npm start or npm run build && npm run build:start
- npm test
FAQs
Build tool to enhance React based SPAs with SSR and frontend micro-services architecture
The npm package webshift receives a total of 52 weekly downloads. As such, webshift popularity was classified as not popular.
We found that webshift 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.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.