angular-architects / nx-ddd-plugin

Nx plugin for structuring a monorepo with domains and layers
313 stars 56 forks source link

ddd-plugin with storybook #61

Closed rip3rs closed 2 years ago

rip3rs commented 3 years ago

For those interested I was attempting to have storyboard with DDD-plugin, but for some reason the tsconfig.json thats is being passed is based on the project app name and not for the feature it self.

I encountered an error like this:

info => Using angular project 'admin' for configuring Storybook. ERR! SyntaxError: Unexpected token } in JSON at position 223 ERR! at JSON.parse () ERR! at getTsConfigOptions (/node_modules/@storybook/angular/dist/server/angular-cli_config.js:41:25) ERR! at Object.getAngularCliWebpackConfigOptions (/node_modules/@storybook/angular/dist/server/angular-cli_config.js:121:20) ERR! at Object.webpackFinal (/node_modules/@storybook/angular/dist/server/framework-preset-angular-cli.js:8:56) ERR! at /node_modules/@storybook/core/dist/server/presets.js:260:28 ERR! SyntaxError: Unexpected token } in JSON at position 223 ERR! at JSON.parse () ERR! at getTsConfigOptions (/node_modules/@storybook/angular/dist/server/angular-cli_config.js:41:25) ERR! at Object.getAngularCliWebpackConfigOptions (/node_modules/@storybook/angular/dist/server/angular-cli_config.js:121:20) ERR! at Object.webpackFinal (/node_modules/@storybook/angular/dist/server/framework-preset-angular-cli.js:8:56) ERR! at /node_modules/@storybook/core/dist/server/presets.js:260:28

admin being my project app name

so I went through the process of trying to understand the problem with mytsconfig 's, and found out that it was pushing in the admin tsconfig.json and not the lib feature one.

After searching a while I encountered this https://github.com/nrwl/nx/issues/2560#issuecomment-604652806 and added a new project both to nx.json and angular.json and it worked.

angular.json

"projects": {
    "storybook": {
      "projectType": "application",
      "root": "",
      "architect": {
        "build": {
          "options": {
            "tsConfig": "tsconfig.base.json"
          }
        }
      }
    },
    "admin": {
      "projectType": "application",
      // ...
    },
    // ...

Hope this helps someone.

To the maintainer not sure if you think of this as a bug / feature. so you decide if it should be closed.

manfredsteyer commented 2 years ago

Thanks for pointing this out