babel-plugin-twine
raw JSON → 1.0.1 verified Fri May 01 auth: no javascript deprecated
Babel plugin for transpiling Twine markup (interactive fiction/storytelling format) into React components. Version 1.0.1. This plugin integrates with Babel to process .twine or custom twine files in your build pipeline, emitting JSX. No other babel twine plugins exist; it is experimental with minimal documentation. Not actively maintained; last update unknown.
Common errors
error Module not found: Can't resolve 'babel-plugin-twine' ↓
cause Package not installed correctly or missing from node_modules.
fix
Run npm install babel-plugin-twine --save-dev or check package.json.
error Error: Cannot find module 'babel-plugin-twine' from '/path/to/project' ↓
cause Babel cannot locate the plugin; it's not in node_modules or name mismatch.
fix
Ensure npm install completed. Use 'twine' (without babel-plugin- prefix) in plugins array.
Warnings
deprecated Package is archived or unmaintained; no updates since initial release. ↓
fix Consider forking or using an alternative like t3js or custom twine parser.
breaking Requires specific Babel version compatibility; may break with Babel 7+. ↓
fix Check peer dependencies; likely works with Babel 6 only.
gotcha No TypeScript definitions or webpack loader included; integration requires manual setup. ↓
fix Create a custom webpack loader for .twine files.
Install
npm install babel-plugin-twine yarn add babel-plugin-twine pnpm add babel-plugin-twine Imports
- default wrong
const twinePlugin = require('babel-plugin-twine')correctimport twinePlugin from 'babel-plugin-twine' - babel config usage wrong
module.exports = { plugins: ['babel-plugin-twine'] }correctmodule.exports = { plugins: ['twine'] } - with custom options wrong
module.exports = { plugins: ['twine', { option: true }] }correctmodule.exports = { plugins: [['twine', { option: true }]] }
Quickstart
// Install: npm install babel-plugin-twine --save-dev
// In your babel config (e.g., babel.config.js):
module.exports = {
plugins: ['twine']
};
// Then in your code, import a twine file (assuming custom loader or webpack):
import story from './story.twine';
// The plugin transforms the twine markup into React components.
// Note: This example assumes a custom loader; twine files are not standard JS.