Skip to content

[Bug]: Rollup error - "validateProps" is not exported #4264

@jebbard

Description

@jebbard

Browser

No response

Package version

3.0.1204

React version

19.1.0

Description

I am building a TS library that provides reusable react components that use CloudScape components. I am bundling this library with TSUP. The library itself builds without issues. However, if I am using this library in another project, I am getting an error when running yarn build:

x Build failed in 16.76s
error during build:
node_modules/@cloudscape-design/components/alert/index.js (7:9): "validateProps" is not exported by "node_modules/@cloudscape-design/components/node_modules/@cloudscape-design/component-toolkit/internal/index.js", imported by "node_modules/@cloudscape-design/components/alert/index.js".
file: /myproject/node_modules/@cloudscape-design/components/alert/index.js:7:9

5: import CoreComponent from './internal-do-not-use-core';
6: import { applyDisplayName } from '../internal/utils/apply-display-name';
7: import { validateProps } from '@cloudscape-design/component-toolkit/internal';
            ^

    at getRollupError (file:///myproject/node_modules/rollup/dist/es/shared/parseAst.js:401:41)
    at error (file:///myproject/node_modules/rollup/dist/es/shared/parseAst.js:397:42)
    at Module.error (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:16875:16)
    at Module.traceVariable (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:17327:29)
    at ModuleScope.findVariable (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:14997:39)
    at ReturnValueScope.findVariable (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:5620:38)
    at FunctionBodyScope.findVariable (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:5620:38)
    at Identifier.bind (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:5394:40)
    at CallExpression.bind (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:2785:23)
    at CallExpression.bind (file:///myproject/node_modules/rollup/dist/es/shared/node-entry.js:12058:15)

yarn build worked for me without issues up to @cloudscape-design/components v3.0.962.

Source code

No response

Reproduction

  • Library:
    • Create a TS library using TSUP
    • Reference "@cloudscape-design/components": "3.0.1204" in package.json (as peer dependency and dev dependency)
    • Export a react component that uses the CS Alert component
  • Project:
    • Import the library in another react project, also reference "@cloudscape-design/components": "3.0.1204" in package.json
    • rm -rd ./node_modules && yarn install && yarn build
    • This results in the error mentioned

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions