Registry / devops / morjs-plugin-compiler-xhs

morjs-plugin-compiler-xhs

JSON →
library0.0.27jsnpmunverified

A compiler plugin for the morjs CLI that adds support for building miniprograms targeting the Xiaohongshu platform. Current version 0.0.27, released as a companion plugin to the morjs multi-platform miniprogram framework. Enables developers to write or convert miniprogram code (e.g., from wx) to the Xiaohongshu (小红书) runtime by integrating with morjs's plugin system. Key differentiator: official morjs plugin set for Xiaohongshu output, built on top of morjs's generic compilation pipeline. Requires @morjs/cli and manual registration via setCompilerPlugins. Ships TypeScript types.

npm install morjs-plugin-compiler-xhs
INSTALL
IMPORT
SIG · MORJS-PLUGIN-COMPI
M
morjs-plugin-compiler-xhs
devopsjavascriptv0.0.27
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.

setCompilerPlugins
import { setCompilerPlugins, getAllCompilerPlugins } from '@morjs/cli'
import setCompilerPlugins from '@morjs/cli'
Default import does not exist; named exports are used.
getAllCompilerPlugins
import { getAllCompilerPlugins } from '@morjs/cli'
const getAllCompilerPlugins = require('@morjs/cli').getAllCompilerPlugins
CommonJS require works as alternative, but ESM is preferred and more reliable with TypeScript types.
PluginXHS
import * as PluginXHS from 'morjs-plugin-compiler-xhs'
import PluginXHS from 'morjs-plugin-compiler-xhs'
This package exports a namespace (all exported members), not a default export. Use import * as or const PluginXHS = require('morjs-plugin-compiler-xhs').

Shows how to register the XHS compiler plugin with morjs using ESM imports and the plugin registration API.

import { setCompilerPlugins, getAllCompilerPlugins } from '@morjs/cli' import * as PluginXHS from 'morjs-plugin-compiler-xhs' const allCompilerTargets: any = getAllCompilerPlugins() setCompilerPlugins([...allCompilerTargets, PluginXHS]) // Then compile a project to Xiaohongshu format via morjs CLI commands
Debug
Known issues
gotchaPackage does not export a default export; must use import * or require to access the plugin object.
fix
Replace `import PluginXHS from 'morjs-plugin-compiler-xhs'` with `import * as PluginXHS from 'morjs-plugin-compiler-xhs'` or use `const PluginXHS = require('morjs-plugin-compiler-xhs')`.
affects: >=0.0.0
gotchaPlugin registration requires both setCompilerPlugins and getAllCompilerPlugins to preserve existing targets; omitting getAllCompilerPlugins will overwrite default plugins and break other platforms.
fix
Always call `getAllCompilerPlugins()` and spread its result when calling `setCompilerPlugins`.
affects: >=0.0.0
gotchaTypeScript types are shipped but may require a tsconfig with `esModuleInterop` or `allowSyntheticDefaultImports` depending on import style.
fix
Enable `esModuleInterop` in tsconfig.json or use `import * as` syntax to avoid type errors.
affects: >=0.0.0
breakingVersion 0.0.x is pre-1.0; API may change without notice. No stability guarantees.
fix
Pin exact version and test thoroughly after updates.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './package.json' is not defined by "exports"
Node.js ESM resolution fails if the package.json does not export './package.json', but this is likely not needed.
fix
Use `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const pkg = require('morjs-plugin-compiler-xhs/package.json')` or just avoid reading package.json.
Module not found: Can't resolve 'morjs-plugin-compiler-xhs'
Package not installed or not in node_modules.
fix
Run `npm install morjs-plugin-compiler-xhs` in the project root.
TypeError: (0 , _cli.setCompilerPlugins) is not a function
Importing setCompilerPlugins incorrectly as default import.
fix
Use `import { setCompilerPlugins } from '@morjs/cli'` (named import).
Upgrade
Version history
0.0.27latest on npm
Audit
Dependencies
@morjs/clirequiredCore morjs CLI that provides plugin registration and compilation infrastructure.
Agent activity
2 hits · last 30 days
node
2
Resources
morjs-plugin-compiler-xhs — npm install morjs-plugin-compiler-xhs · libregistry