Registry / web-framework / create-app

create-app

JSON →
library2.1.0jsnpmunverified

A JavaScript library for isomorphic (client/server) single-page applications with unified configuration for routing and rendering. Version 2.1.0 is the latest stable release. Key differentiators include a single configuration for both client and server rendering, built-in history management, and minimal boilerplate. Designed for use with ES6 transpilers like Babel, with separate entry points for client and server.

npm install create-app
INSTALL
IMPORT
SIG · CREATE-APP
C
create-app
web-frameworkjavascriptv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createApp (client)
import createApp from 'create-app/client'
import createApp from 'create-app'
Must import from 'create-app/client' for client-side usage; default export is not available from the main entry.
createApp (server)
import createApp from 'create-app/server'
const createApp = require('create-app/client')
Server-side rendering requires the server entry point. CommonJS require is also supported.
createApp (CommonJS client)
const createApp = require('create-app/client')
const createApp = require('create-app')
When using CommonJS, ensure the correct subpath is specified.

Demonstrates creating a client app with a container and basename, starting it, and pushing a random history entry.

import createApp from 'create-app/client'; const app = createApp({ container: 'body', basename: '/abc', }); app.start(); let targetPath = `/random${Math.random().toString(36).substr(2, 6)}`; app.history.push(targetPath);
create-app --version
Debug
Known issues
gotchaRendering fails if container element does not exist in DOM on client side.
fix
Ensure the container element (e.g., 'body') exists before calling createApp.
affects: all
deprecatedThe 'start' method second argument (resolve) is deprecated in v2.0.0.
fix
Omit the second argument or use 'app.start()' without resolve.
affects: >=2.0.0
breakingIn v2.0.0, the API changed from using 'createApp()' without arguments to requiring a configuration object.
fix
Pass a configuration object like { container: 'body', basename: '/' }.
affects: >=2.0.0
gotchaCommonJS require without subpath does not export anything.
fix
Use 'require("create-app/client")' or 'require("create-app/server")'.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Can't resolve 'create-app'
Installation missing or incorrect import path.
fix
Run 'npm install create-app' and use correct import path: 'create-app/client'.
TypeError: createApp is not a function
Default import without subpath returns undefined.
fix
Import from subpath: 'import createApp from "create-app/client"'.
Cannot read property 'push' of undefined
App not started or history not initialized.
fix
Call 'app.start()' before using 'app.history.push()'.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
create-app — npm install create-app · libregistry