Registry / devops / babel-preset-liferay-standard

babel-preset-liferay-standard

JSON →
library2.32.2jsnpmunverified

A Babel preset for bundling standard (browser-compatible) npm modules in Liferay projects. Current stable version is 2.32.2. It is maintained as part of the Liferay frontend projects monorepo, with releases tied to the liferay-js-toolkit package. The preset includes plugins for normalizing requires, inlining NODE_ENV, dead code elimination, AMD module wrapping, naming, and namespace handling. It differentiates from generic Babel presets by providing Liferay-specific transformations for AMD module support and namespace isolation.

npm install babel-preset-liferay-standard
INSTALL
IMPORT
SIG · BABEL-PRESET-LIFER
B
babel-preset-liferay-standard
devopsjavascriptv2.32.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import babelPresetLiferayStandard from 'babel-preset-liferay-standard'
const babelPresetLiferayStandard = require('babel-preset-liferay-standard')
ESM default import is preferred; CommonJS require works but may not tree-shake.
liferayStandard
import { liferayStandard } from 'babel-preset-liferay-standard'
import { LiferayStandard } from 'babel-preset-liferay-standard'
Named export is lowercase camelCase.
Config
import type { Config } from 'babel-preset-liferay-standard'
import { Config } from 'babel-preset-liferay-standard'
Use type import for TypeScript type definitions.

Demonstrates three ways to configure babel-preset-liferay-standard: .babelrc file, babel.config.js, and package.json babel field.

// Install: npm install --save-dev babel-preset-liferay-standard // .babelrc { "presets": ["liferay-standard"] } // babel.config.js module.exports = { presets: ['babel-preset-liferay-standard'] }; // package.json { "babel": { "presets": ["liferay-standard"] } }
Debug
Known issues
breakingIn version 2.x, the preset requires Babel 7. Using with Babel 6 will throw errors.
fix
Upgrade to Babel 7 or use babel-preset-liferay-standard@1.x.
affects: >=2.0.0
deprecatedbabel-plugin-transform-node-env-inline may be deprecated in future releases; prefer using @babel/plugin-transform-node-env-inline.
fix
Manually replace with the standalone plugin if needed.
affects: >=2.0.0
gotchaThe preset includes dead code elimination; ensure that process.env.NODE_ENV is set correctly to avoid accidental removal of development code.
fix
Set NODE_ENV=production for production builds or use cross-env.
affects: >=2.0.0
gotchaAMD module wrapping can cause conflicts with other module systems (e.g., CommonJS). Ensure your project is AMD-compatible.
fix
Use the preset only in Liferay AMD environments or disable AMD plugins if not needed.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'babel-preset-liferay-standard'
Package not installed or missing from devDependencies.
fix
Run: npm install --save-dev babel-preset-liferay-standard
ReferenceError: define is not defined
AMD module wrapping expects an AMD loader (e.g., RequireJS) to be present in the browser.
fix
Ensure an AMD loader (like RequireJS) is included or use the preset with a bundler that supports AMD output.
TypeError: Cannot read property 'presets' of undefined
Babel configuration file is malformed or missing module.exports.
fix
Export an object with a presets array: module.exports = { presets: ['liferay-standard'] };
Error: Plugin 2 specified in ".../node_modules/babel-preset-liferay-standard/index.js" returned an object with a "visitor" property, but Babel expects a function.
Incompatible Babel plugin version (e.g., Babel 6 plugin in Babel 7).
fix
Upgrade to Babel 7 or ensure all peer dependencies match.
Upgrade
Version history
2.32.2latest on npm
Audit
Dependencies
babel-plugin-normalize-requiresrequirednormalizes require paths
babel-plugin-transform-node-env-inlinerequiredinlines NODE_ENV checks
babel-plugin-minify-dead-code-eliminationrequiredremoves dead code
babel-plugin-wrap-modules-amdrequiredwraps modules in AMD define
babel-plugin-name-amd-modulesrequirednames AMD modules
babel-plugin-namespace-modulesrequirednamespaces modules
babel-plugin-namespace-amd-definerequirednamespaces AMD define calls
Agent activity
2 hits · last 30 days
node
2
Resources
babel-preset-liferay-standard — npm install babel-preset-liferay-standard · libregistry