babel-preset-es2015-riot
raw JSON → 1.1.0 verified Sat Apr 25 auth: no javascript deprecated
Babel preset for Riot.js that enables ES2015 (ES6) features, including modules, in Riot tags. Latest version 1.1.0 is stable, no longer maintained. It wraps the standard babel-preset-es2015. Designed specifically for Riot.js development. Alternatives: use @babel/preset-env instead.
Common errors
error Cannot find module 'babel-preset-es2015-riot' ↓
cause Package not installed or missing from node_modules.
fix
Run 'npm install babel-preset-es2015-riot --save-dev'.
error Error: Requires Babel "^7.0.0-0", but was loaded with "6.x.x" ↓
cause This preset is for Babel 6, not Babel 7.
fix
Use the legacy Babel 6 or switch to @babel/preset-env for Babel 7.
Warnings
deprecated This package is deprecated. The babel-preset-es2015 family is superseded by @babel/preset-env. Do not use for new projects. ↓
fix Replace with @babel/preset-env and set targets as needed.
gotcha This preset only includes es2015 plugins, not es2016 or later. For modern JavaScript, use @babel/preset-env. ↓
fix Use @babel/preset-env which compiles based on target environments.
gotcha If using babel helpers, you must add the external-helpers-2 plugin separately. This is not included in the preset. ↓
fix Add 'plugins': ['external-helpers-2'] to your .babelrc.
Install
npm install babel-preset-es2015-riot yarn add babel-preset-es2015-riot pnpm add babel-preset-es2015-riot Imports
- default (preset) wrong
require('babel-preset-es2015-riot') in codecorrectIn .babelrc: { "presets": ["es2015-riot"] }
Quickstart
// .babelrc
{
"presets": ["es2015-riot"]
}
// Or if using with webpack babel-loader:
// webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015-riot']
}
}
}
]
}
};