{"id":18490,"library":"liferay-npm-build-tools-common","title":"liferay-npm-build-tools-common","description":"Utility library for Liferay NPM Build Tools, version 2.32.2, maintained by Liferay. It provides shared utilities across Liferay's frontend build toolchain, including npm-scripts, liferay-theme-tasks, and eslint-plugin. It is part of the liferay-frontend-projects monorepo and follows irregular release cadence alongside other packages. Key differentiator: tightly coupled with Liferay portal ecosystem, intended for use within Liferay workspace projects, not a general-purpose npm build tool.","status":"active","version":"2.32.2","language":"javascript","source_language":"en","source_url":"https://github.com/liferay/liferay-frontend-projects","tags":["javascript"],"install":[{"cmd":"npm install liferay-npm-build-tools-common","lang":"bash","label":"npm"},{"cmd":"yarn add liferay-npm-build-tools-common","lang":"bash","label":"yarn"},{"cmd":"pnpm add liferay-npm-build-tools-common","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only as of v2. No support for CommonJS require().","wrong":"const { getProjectDependencies } = require('liferay-npm-build-tools-common');","symbol":"getProjectDependencies","correct":"import { getProjectDependencies } from 'liferay-npm-build-tools-common';"},{"note":"getProjectDependencies is a named export, not a default export.","wrong":"import getProjectDependencies from 'liferay-npm-build-tools-common';","symbol":"getProjectDependencies","correct":"import { getProjectDependencies } from 'liferay-npm-build-tools-common';"},{"note":"No deep import paths exported; all symbols are at package root.","wrong":"import { Project } from 'liferay-npm-build-tools-common/lib/Project';","symbol":"Project","correct":"import { Project } from 'liferay-npm-build-tools-common';"},{"note":"FileUtil is a class with static methods; not instantiatable.","wrong":"","symbol":"FileUtil","correct":"import { FileUtil } from 'liferay-npm-build-tools-common';"}],"quickstart":{"code":"import { getProjectDependencies, Project } from 'liferay-npm-build-tools-common';\n\n// Instantiate a Project instance with the current working directory\nconst project = new Project('/path/to/project');\n\n// Get dependencies of the project\nconst deps = getProjectDependencies(project);\nconsole.log(deps); // Array of dependency names","lang":"typescript","description":"Shows how to import the main utilities, create a Project instance, and retrieve its dependencies."},"warnings":[{"fix":"Update to v2.0.0 or later and refactor imports to use named exports.","message":"Package moved from 'liferay-npm-build-tools-common' to 'liferay-npm-build-tools-common' (same name) but internal API may have changed; check v2 migration guide.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Always provide a valid directory path to new Project().","message":"Project constructor expects a rootDir string; if passed undefined, it may throw or return unexpected results.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use import syntax or configure bundler to handle ESM.","message":"Package does not support CommonJS; using require() will throw Module not found error.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Only use within a Liferay workspace project.","message":"FileUtil methods assume a Liferay workspace structure; using outside Liferay context may yield incorrect results.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install liferay-npm-build-tools-common --save-dev","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'liferay-npm-build-tools-common'"},{"fix":"Add 'type': 'module' to package.json or use .mjs extension.","cause":"Using ESM import in a CommonJS context (e.g., Node without type:module).","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use import { getProjectDependencies } from 'liferay-npm-build-tools-common'","cause":"Incorrect import style (default import instead of named import).","error":"TypeError: getProjectDependencies is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}