Skip to content

Build Failure with Liferay CLI on React Portlets Regardless of Node.js Version #1053

Open
@FrederickBosa

Description

@FrederickBosa

Build Failure with Liferay CLI for React Portlets

Issue Description

Attempting to build a new React Portlet using Liferay CLI fails irrespective of the Node.js version. This issue significantly hampers the development processes for teams using Liferay CLI to manage React Portlets.

Steps to Reproduce

  1. Environment Setup: Clone a standard Liferay CLI React Portlet project.
  2. Install Dependencies: Run npm install to install necessary packages.
  3. Build Command: Execute npm run build or liferay build.

Actual Output

The build process fails, outputting the following error in the terminal:
```
Error: ---\src\AppComponent.js: Binding not found for ReferencedIdentifier "AppComponent" present in "AssignmentExpression".
```

Expected Output

The build process should complete successfully without errors, indicating the project was built correctly.

Debugging Steps Undertaken

  • Temporary Mitigation: Replacing package-lock.json with a previous version bypasses the error temporarily.
  • Node.js Versions Tested: Multiple, confirming the issue is not related to Node.js itself.

Minimal Code to Reproduce the Bug

```js
// Standard setup code for Liferay CLI React Portlet as generated by the CLI
```

Stack Trace

```
Error: C:\Users\frederick.bosa\Downloads\failed-build\src\AppComponent.js: Binding not found for ReferencedIdentifier "AppComponent" present in "AssignmentExpression".
at ReferencedIdentifier (C:\Users\frederick.bosa\Downloads\failed-build\node_modules\babel-plugin-minify-mangle-names\lib\index.js:199:19)
```

Configuration

  • babel-minify configuration: Default as configured by Liferay CLI.
  • .babelrc: Not manually adjusted, uses Liferay CLI defaults.

Use with Other Presets/Plugins

  • No additional babel presets or plugins were manually included beyond the default Liferay setup.

Environment

  • Build Tools: Liferay CLI
  • Module Bundlers and Task Runners: Utilized within Liferay's standard environment settings.

Additional Details

Conclusion

The recurring issue points towards a potential compatibility or configuration problem within the minification process utilized by Liferay's build tools, possibly related to babel-plugin-minify. The replacement of package-lock.json suggests dependency conflicts or specific versions causing the failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions