Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
configureWebpack,
getEngine,
getPages,
getPageId,
readFileWithProps,
gracefullyShutDown,
sleep,
Config,
} from '@react-ssr/core';
const cwd = process.cwd();
const env = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const ext = '.' + getEngine();
const codec = require('json-url')('lzw');
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
// onchange bundling
async function bundle(config: Config, ufs: any, memfs: any): Promise;
// initial bundling
async function bundle(config: Config, ufs: any, memfs: any, app: NestExpressApplication): Promise;
async function bundle(config: Config, ufs: any, memfs: any, app?: NestExpressApplication) {
const entry: webpack.Entry = {};
const entryPages = await getPages();
const entryPath = path.resolve(require.resolve('@react-ssr/core'), '../webpack/entry.js');
const template = fse.readFileSync(entryPath).toString();
memfs.mkdirpSync(path.join(cwd, 'react-ssr-src'));
Config,
configure,
getEngine,
getPages,
getPageId,
readFileWithProps,
// gracefullyShutDown,
sleep,
} from '@react-ssr/core';
const cwd = process.cwd();
const env = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const ext = '.' + getEngine();
const codec = require('json-url')('lzw');
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
// onchange bundling
async function bundle(config: Config, ufs: any, memfs: any): Promise;
// initial bundling
async function bundle(config: Config, ufs: any, memfs: any, app: NestExpressApplication): Promise;
async function bundle(config: Config, ufs: any, memfs: any, app?: NestExpressApplication) {
const entry: webpack.Entry = {};
const [entryPages, otherPages] = await getPages(config);
const entryPath = path.resolve(require.resolve('@react-ssr/core'), '../webpack/entry.js');
const template = fse.readFileSync(entryPath).toString();
for (let i = 0; i < entryPages.length; i++) {
import MemoryFileSystem from 'memory-fs';
import path from 'path';
import express from 'express';
import webpack from 'webpack';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
getSsrConfig,
getPageId,
sleep,
} from '../helpers';
const cwd = process.cwd();
const config = getSsrConfig();
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
export default async (app: express.Application): Promise => {
fse.removeSync(path.join(cwd, config.distDir));
let compiled = false;
const [entry, entryPages] = await getEntry(memfs);
const webpackConfig: webpack.Configuration = configureWebpack(entry);
const compiler: webpack.Compiler = webpack(webpackConfig);
compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
compiler.inputFileSystem = ufs;
compiler.run((err: Error, stats: webpack.Stats) => {
err && console.error(err.stack || err);
stats.hasErrors() && console.error(stats.toString());
import fse from 'fs-extra';
import MemoryFileSystem from 'memory-fs';
import path from 'path';
import express from 'express';
import webpack from 'webpack';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
getPageId,
staticConfig,
sleep,
} from '../helpers';
const cwd = process.cwd();
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
export default async (app: express.Application): Promise => {
fse.removeSync(path.join(cwd, staticConfig.distDir));
let compiled = false;
const [entry, entryPages] = await getEntry(memfs);
const webpackConfig: webpack.Configuration = configureWebpack(entry);
const compiler: webpack.Compiler = webpack(webpackConfig);
compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
compiler.inputFileSystem = ufs;
compiler.run((err: Error, stats: webpack.Stats) => {
err && console.error(err.stack || err);
stats.hasErrors() && console.error(stats.toString());
import path from 'path';
import express from 'express';
import proxy from 'http-proxy-middleware';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
getPageId,
staticConfig,
sleep,
} from '../helpers';
const cwd = process.cwd();
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
export default async (app: express.Application): Promise => {
fse.removeSync(path.join(cwd, staticConfig.distDir));
let compiled = false;
const [entry, entryPages] = await getEntry(memfs);
const webpackConfig: webpack.Configuration = configureWebpack(entry);
const compiler: webpack.Compiler = webpack(webpackConfig);
compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
compiler.inputFileSystem = ufs;
const devServerPort = 8888;
const devServer = new WebpackDevServer(compiler, {
hot: true,
import express from 'express';
import proxy from 'http-proxy-middleware';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { configureWebpack } from './webpack.config';
import { getEntry } from './helpers';
import {
getSsrConfig,
getPageId,
sleep,
} from '../helpers';
const cwd = process.cwd();
const config = getSsrConfig();
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
export default async (app: express.Application): Promise => {
fse.removeSync(path.join(cwd, config.distDir));
let compiled = false;
const [entry, entryPages] = await getEntry(memfs);
const webpackConfig: webpack.Configuration = configureWebpack(entry);
const compiler: webpack.Compiler = webpack(webpackConfig);
compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
compiler.inputFileSystem = ufs;
const devServerPort = 8888;
const devServer = new WebpackDevServer(compiler, {
hot: true,
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { configureWebpack } from '../webpack.config';
import { getEntry } from './helpers';
import {
getSsrConfig,
getPageId,
readFileWithProps,
sleep,
} from '../helpers/core';
const cwd = process.cwd();
const config = getSsrConfig();
const codec = require('json-url')('lzw');
const ufs = require('unionfs').ufs;
const memfs = new MemoryFileSystem();
ufs.use(fs).use(memfs);
export default async (app: express.Application): Promise => {
fse.removeSync(path.join(cwd, config.distDir));
let compiled = false;
const [entry, entryPages] = await getEntry(memfs);
const webpackConfig: webpack.Configuration = configureWebpack(entry);
const compiler: webpack.Compiler = webpack(webpackConfig);
compiler.hooks.afterCompile.tap('finish', () => { compiled = true });
compiler.inputFileSystem = ufs;
const devServerPort = 8888;
const devServer = new WebpackDevServer(compiler, {
hot: true,