oc-statics-compiler
raw JSON → 3.0.1 verified Fri May 01 auth: no javascript
OC-Statics-Compiler is a generic module for processing static assets in OpenComponents templates. Current version 3.0.1 ships TypeScript types and is intended for use with the OpenComponents ecosystem. Release cadence is low; maintained primarily by the OpenComponents team. Differentiators are its tight integration with the OC registry and its statics processing pipeline. Not intended for standalone use outside of OC-based projects.
Common errors
error Cannot find module 'oc-statics-compiler' ↓
cause Package not installed or missing in node_modules.
fix
Run 'npm install oc-statics-compiler' or 'yarn add oc-statics-compiler'.
error require() of ES Module not supported ↓
cause Using CommonJS require() with ESM-only package v3+.
fix
Switch to ESM with 'import ocStaticsCompiler from 'oc-statics-compiler'' or downgrade to v2.x.
error TypeError: ocStaticsCompiler.process is not a function ↓
cause Using default import but the default export is not a function; possibly wrong import or outdated version.
fix
Ensure you import the correct symbol: import ocStaticsCompiler from 'oc-statics-compiler' and check that version is >=3.0.0.
Warnings
breaking v3 changed to ESM-only; require() throws error. ↓
fix Use import instead of require; update your project to ESM with type: 'module' in package.json.
deprecated processStatics() function deprecated in v2.5.0, removed in v3. ↓
fix Use default export's process() method instead.
gotcha StaticsConfig type may require explicit import; not exported from index.d.ts in some versions. ↓
fix Upgrade to v3.0.1 or use // @ts-ignore if type not found.
deprecated Node.js v10 and v12 support dropped in v3. ↓
fix Use Node.js v14 or later.
Install
npm install oc-statics-compiler yarn add oc-statics-compiler pnpm add oc-statics-compiler Imports
- default wrong
const ocStaticsCompiler = require('oc-statics-compiler')correctimport ocStaticsCompiler from 'oc-statics-compiler' - processStatics wrong
import processStatics from 'oc-statics-compiler'correctimport { processStatics } from 'oc-statics-compiler' - StaticsConfig wrong
import { StaticsConfig } from 'oc-statics-compiler'correctimport type { StaticsConfig } from 'oc-statics-compiler'
Quickstart
import ocStaticsCompiler from 'oc-statics-compiler';
const result = ocStaticsCompiler.process({
componentName: 'my-component',
version: '1.0.0',
statics: ['style.css', 'script.js']
});
console.log(result);
// Output: processed statics object with resolved paths