Registry / ycp-rollup-starter-lib

ycp-rollup-starter-lib

JSON →
library1.0.16jsnpmunverified

A bare-bones example repository demonstrating how to create a JavaScript library using Rollup, including importing a CommonJS module from node_modules. The library 'how-long-till-lunch' uses the 'ms' package to calculate time until lunch. This is a starter template, not a standalone library; version 1.0.16 is active but has no maintainer activity. Key differentiators: it provides CommonJS, ES module, and UMD builds via Rollup, with variations for Babel or Bublé transpilation. Not intended for production use as a dependency.

npm install ycp-rollup-starter-lib
INSTALL
IMPORT
SIG · YCP-ROLLUP-STARTER
Y
ycp-rollup-starter-lib
javascriptv1.0.16
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

default
import howLongTillLunch from './how-long-till-lunch';
The library exports a default function.
require
const howLongTillLunch = require('./how-long-till-lunch.cjs.js');
const howLongTillLunch = require('how-long-till-lunch');
Use the CommonJS file path for Node.js require.
script tag
<script src="dist/how-long-till-lunch.umd.js"></script>
The UMD build exposes the library as a global variable.

Shows how to clone, build, and use the example library with ES module import syntax, demonstrating the standard workflow for this starter.

// Clone and build the library git clone https://github.com/rollup/rollup-starter-lib.git cd rollup-starter-lib npm install npm run build // Create a test file: test.mjs import howLongTillLunch from './dist/how-long-till-lunch.esm.js'; console.log('Lunch in:', howLongTillLunch()); // Run with node node test.mjs
Debug
Known issues
gotchaThis package is a starter template, not a published library. Do not install it as a dependency (npm install ycp-rollup-starter-lib) expecting a usable library.
fix
Clone the GitHub repo instead: git clone https://github.com/rollup/rollup-starter-lib.git
affects: >=1.0.0
deprecatedThe Greenkeeper badge is outdated. Greenkeeper was acquired by Snyk and the service changed.
fix
Consider using Dependabot or Renovate for dependency updates.
affects: >=1.0.0
gotchaThe 'ms' dependency is a devDependency in the starter, but the example imports it as if it were a runtime dependency. This may confuse beginners.
fix
If you use the starter as a base for your own library, move 'ms' to dependencies if your library uses it at runtime.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'ms'
The 'ms' package is installed as a devDependency but your code uses it at runtime. Running the built library outside the project directory fails.
fix
Run npm install --save ms to add it as a runtime dependency, or ensure you run your application from within the project directory.
npm ERR! code ELIFECYCLE
Build script fails due to missing rollup or other dev dependencies.
fix
Run npm install before npm run build.
SyntaxError: Unexpected token 'export'
Trying to run the ES module file directly with older Node.js versions (<13) without ESM support.
fix
Use Node.js version 13 or later with --experimental-modules flag, or use the CommonJS bundle instead.
Upgrade
Version history
1.0.16latest on npm
Audit
Dependencies
msoptionalUsed in the example library to parse time strings like '2 hours'.
Agent activity
4 hits · last 30 days
node
4
Resources
ycp-rollup-starter-lib — npm install ycp-rollup-starter-lib · libregistry