All Projects → moxystudio → webpack-isomorphic-compiler

moxystudio / webpack-isomorphic-compiler

Licence: MIT license
A compiler that makes your life easier if you are building isomorphic webpack powered apps, that is, single page applications with server-side rendering

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to webpack-isomorphic-compiler

Razzle Material Ui Styled Example
Razzle Material-UI example with Styled Components using Express with compression
Stars: ✭ 117 (+631.25%)
Mutual labels:  isomorphic, universal, ssr, server-side-rendering
Beidou
🌌 Isomorphic framework for server-rendered React apps
Stars: ✭ 2,726 (+16937.5%)
Mutual labels:  isomorphic, universal, ssr, server-side-rendering
react-ssr-hydration
Example of React Server Side Rendering with Styled Components and Client Side Hydration
Stars: ✭ 15 (-6.25%)
Mutual labels:  isomorphic, universal, server-side-rendering
Typescript Hapi React Hot Loader Example
Simple TypeScript React Hot Loading example with Hapi Server-side rendering
Stars: ✭ 44 (+175%)
Mutual labels:  isomorphic, ssr, server-side-rendering
Egg Vue Webpack Boilerplate
Egg Vue Server Side Render (SSR) / Client Side Render (CSR)
Stars: ✭ 1,302 (+8037.5%)
Mutual labels:  isomorphic, ssr, server-side-rendering
isomorphic-react-redux-saga-ssr
Isomorphic, React, Redux, Saga, Server Side rendering, Hot Module Reloading, Ducks, Code Splitting
Stars: ✭ 19 (+18.75%)
Mutual labels:  isomorphic, ssr, server-side-rendering
Nuxt.js
The Intuitive Vue(2) Framework
Stars: ✭ 38,986 (+243562.5%)
Mutual labels:  isomorphic, universal, ssr
Universal React Demo
ES6 demo of a simple but scalable React app with react-router, code splitting, server side rendering, and tree shaking.
Stars: ✭ 50 (+212.5%)
Mutual labels:  isomorphic, universal, server-side-rendering
Awesome Nextjs
📔 📚 A curated list of awesome resources : books, videos, articles about using Next.js (A minimalistic framework for universal server-rendered React applications)
Stars: ✭ 6,812 (+42475%)
Mutual labels:  isomorphic, universal, server-side-rendering
Celestite
Beautifully reactive, server-side rendered Svelte apps w/ a Crystal backend
Stars: ✭ 185 (+1056.25%)
Mutual labels:  isomorphic, universal, ssr
Use Ssr
☯️ React hook to determine if you are on the server, browser, or react native
Stars: ✭ 230 (+1337.5%)
Mutual labels:  isomorphic, ssr, server-side-rendering
react-ssr-starter
📚 Featuring Webpack 4, React 17-18, SSR, HMR, prefetching, universal lazy-loading, and more
Stars: ✭ 18 (+12.5%)
Mutual labels:  isomorphic, universal, ssr
Hackernews
HackerNews clone built with Nuxt.js
Stars: ✭ 758 (+4637.5%)
Mutual labels:  isomorphic, universal, ssr
fastify-vite
This plugin lets you load a Vite client application and set it up for Server-Side Rendering (SSR) with Fastify.
Stars: ✭ 497 (+3006.25%)
Mutual labels:  isomorphic, universal, server-side-rendering
Universal
Seed project for Angular Universal apps featuring Server-Side Rendering (SSR), Webpack, CLI scaffolding, dev/prod modes, AoT compilation, HMR, SCSS compilation, lazy loading, config, cache, i18n, SEO, and TSLint/codelyzer
Stars: ✭ 669 (+4081.25%)
Mutual labels:  isomorphic, universal, server-side-rendering
Hapi React Hot Loader Example
Simple React Hot Loading example with Hapi Server-side rendering
Stars: ✭ 44 (+175%)
Mutual labels:  isomorphic, ssr, server-side-rendering
React Server
🚀 Blazing fast page load and seamless navigation.
Stars: ✭ 3,932 (+24475%)
Mutual labels:  isomorphic, universal, ssr
React App
Create React App with server-side code support
Stars: ✭ 614 (+3737.5%)
Mutual labels:  isomorphic, ssr, server-side-rendering
Koa React Universal
lightweight React-Koa2 universal boilerplate, only what is essential
Stars: ✭ 112 (+600%)
Mutual labels:  isomorphic, universal, ssr
Universal React
A universal react starter, with routing, meta, title, and data features
Stars: ✭ 247 (+1443.75%)
Mutual labels:  isomorphic, universal, server-side-rendering

webpack-isomorphic-compiler

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status

A compiler that makes your life easier if you are building isomorphic webpack powered apps, that is, single page applications with server-side rendering.

Installation

$ npm install webpack-isomorphic-compiler --save-dev

The current version works with webpack v2, v3 and v4.

Motivation

With webpack, client-side applications with server-side rendering means compiling both the client and the server.
To make it right, the client and server compilers must be in sync and live in perfect harmony.

Webpack offers a multi-compiler that makes this possible, but unfortunately it doesn't have all the plugin handlers that a single compiler does. This makes it difficult to know what's happening under the hood.

This module packs an aggregated compiler that:

NOTE: While webpack-sane-compiler-reporter is compatible with this compiler, we advise using webpack-isomorphic-compiler-reporter instead for completeness and accurateness.

Usage

const webpack = require('webpack');
const isomorphicWebpack = require('webpack-isomorphic-compiler');

const clientCompiler = webpack(/* client config */);
const serverCompiler =  webpack(/* server config */);
const compiler = isomorphicWebpack(clientCompiler, serverCompiler);

Alternatively, you may pass a config directly instead of a webpack compiler:

const webpack = require('webpack');

const compiler = isomorphicWebpack(/* client config */, /* server config */);

The returned compiler has exactly the same API as the webpack-sane-compiler but adds some functionality that is detailed below.

Compilation result

The compilation result, available through .run(), .watch(), .getCompilation() and .resolve(), has two more properties:

compiler.run()
.then(({ clientStats, serverStats, stats, duration }) => {
    // clientStats is the webpack stats of the client
    // serverStats is the webpack stats of the client
    // duration is the aggregated compilation duration
    // stats maps to clientStats for API compatibility
})

Client & server webpack

Both client and server properties contain their webpack configs & compilers.

Name Description Type
webpackCompiler The client's webpack compiler Compiler
webpackConfig The client's webpack config object

Accessing webpack compiler public methods is NOT allowed and will throw an error.

Related projects

You may also want to look at:

Tests

$ npm test
$ npm test -- --watch during development

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].