rollup-to-nej

raw JSON →
1.3.0 verified Fri May 01 auth: no javascript maintenance

A build tool that transforms Vue single-file components (.vue) and ES module code into NEJ-style AMD modules with NEJ.define() wrappers. Current version 1.3.0. Provides a command-line interface (roll, rollup) and programmatic API (doRollup). Supports alias mapping to avoid bundling common modules, comment removal, and external Babel helpers. It is a niche tool for projects migrating from Vue/ESM to the NEJ module system, with no active development observed since 2020.

error Error: Cannot find module 'rollup-to-nej'
cause Package not installed or incorrectly required (e.g., using import instead of require).
fix
Install via 'npm install rollup-to-nej' and use 'const doRollup = require('rollup-to-nej');'
error roll: command not found
cause CLI binary 'roll' not in PATH; package not installed globally or not used via npx.
fix
Use 'npx roll ...' or install globally: 'npm i -g rollup-to-nej'.
error SyntaxError: Unexpected token '<'
cause Input file is a .vue template but the tool expects JavaScript; missing proper .vue file extension or configuration.
fix
Ensure input files have .vue extension and the 'vue' preset is used: 'roll build vue -i ...'
breaking Deprecated and unmaintained: no updates since 2020. May not work with modern Rollup or Vue versions (>2.x).
fix Consider migrating to Vite or webpack with NEJ plugins if needed.
gotcha The CLI binary is named 'roll' (not 'rollup-to-nej' or 'rollup'). Installing globally or using npx requires exact command.
fix Use 'npx roll build vue ...' or install globally with 'npm i -g rollup-to-nej'.
gotcha Alias syntax requires careful quoting: -s @nej=./src (no spaces around =). Using @ inside aliases (e.g., @**) is not recommended.
fix Always quote or escape values that contain special shell characters, e.g., -s "@nej=./src".
deprecated The generated code includes a 'normalizeComponent' function from vue-component-compiler, which may not be compatible with Vue 3 or NEJ updates.
fix Manually review and adjust output for target environment.
npm install rollup-to-nej
yarn add rollup-to-nej
pnpm add rollup-to-nej

Programmatic build using the API: bundles .vue and .js files from 'raw' to 'src' with NEJ.define wrapping, aliases, and option to remove comments.

const doRollup = require('rollup-to-nej');
doRollup.build('vue', {
  input: 'raw',
  output: 'src',
  alias: {
    '@nej': './src',
    'vueSrc': '../../'
  },
  removeComments: true,
  externalHelpers: false
});