Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Angular outputPath object not supported (TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string.) #28143

Closed
vbraun opened this issue Jun 7, 2024 · 0 comments · Fixed by #28144

Comments

@vbraun
Copy link

vbraun commented Jun 7, 2024

Describe the bug

As part of the new esbuild-based build pipeline, Angular added more control about output paths and the outputPath can now be an object instead of just a plain string. For example, in angular.json you can now set

      [...]
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            "outputPath": {
              "base": "dist/angular-latest",
              "media": "media"
            },

However, when using that in angular.json, storybook fails to start with

=> Failed to build the preview
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received an instance of Object
    at __node_internal_captureLargerStackTrace2 (https://rlmipnnmvgithub-lgjm.w-credentialless-staticblitz.com/builtins.5bf3667c.js:101:5335)
    at new NodeError (https://rlmipnnmvgithub-lgjm.w-credentialless-staticblitz.com/builtins.5bf3667c.js:101:4149)
    at validateString (https://rlmipnnmvgithub-lgjm.w-credentialless-staticblitz.com/builtins.5bf3667c.js:265:1272)
    at Object.resolve (https://rlmipnnmvgithub-lgjm.w-credentialless-staticblitz.com/builtins.5bf3667c.js:287:7403)
    at getCommonConfig (./node_modules/@angular-devkit/build-angular/src/tools/webpack/configs/common.js:275:24)
    at async Promise.all (index 0)
    at async generateWebpackConfig (./node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:60:22)
    at async generateBrowserWebpackConfigFromContext (./node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:117:20)
    at async generateI18nBrowserWebpackConfigFromContext (./node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:67:20)
    at async exports.getWebpackConfig (./node_modules/@storybook/angular/dist/server/angular-cli-webpack.js:42:35)
    at async Object.webpack (./node_modules/@storybook/builder-webpack5/dist/presets/custom-webpack-preset.js:1:3173)
    at async starter (./node_modules/@storybook/builder-webpack5/dist/index.js:1:6267)
    at async Module.start (./node_modules/@storybook/builder-webpack5/dist/index.js:1:10138)
    at async storybookDevServer (./node_modules/@storybook/core-server/dist/index.js:40:7719)
    at async buildOrThrow (./node_modules/@storybook/core-server/dist/index.js:36:1975)
    at async buildDevStandalone (./node_modules/@storybook/core-server/dist/index.js:78:1323)
    at async withTelemetry (./node_modules/@storybook/core-server/dist/index.js:40:3599)

Reproduction link

https://stackblitz.com/edit/github-uzgadq-yz5lzq?file=angular.json

Reproduction steps

  1. go to the stackblitz link
  2. watch storybook crash on start

Alternatively, open any angular+storybook project and switch the outputPath into object syntax. Result is that storybook fails to start.

System

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-docs: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    @storybook/addon-essentials: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    @storybook/addon-interactions: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    @storybook/addon-links: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    @storybook/angular: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    @storybook/blocks: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    @storybook/test: ^8.2.0-alpha.5 => 8.2.0-alpha.6 
    storybook: ^8.2.0-alpha.5 => 8.2.0-alpha.6

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant