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] start-storybook breaks when tsconfig.json has comments (preset-create-react-app) #247

Open
manuartero opened this issue Apr 28, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@manuartero
Copy link

manuartero commented Apr 28, 2022

Describe the bug

This sounds cracy but I do reproduce the following:

-> React ts project (created used create-react-app)
-> Storybook uses regular .jsx files
-> tsconfig.json at root looks:

 "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "baseUrl": "src",
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"]

I run (from package.json)

"scripts": {
  ...
  "storybook": "start-storybook -p 9009 -s public",
  ...
}

And everything works like a charm.


***

NOW, I add a comment to tsconfig.json

"compilerOptions": {
+   // whatever
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],

And start-storybook -p 9009 -s public just breaks.

It raises multiple (several) ModuleNotFoundError

ModuleNotFoundError: Module not found: Error: Can't resolve ....

Expected behavior

Writting down a comment doesn't break the build

Screenshots and/or logs

please do ignore the specifics:

ModuleNotFoundError: Module not found: Error: Can't resolve 'utils/test-utils' in '/my-project/src/my-code'
    at /my-project/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/Compilation.js:925:10
    at /my-project/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/NormalModuleFactory.js:401:22
    at /my-project/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/NormalModuleFactory.js:130:21
    at /my-project/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/NormalModuleFactory.js:224:22
    at /my-project/node_modules/neo-async/async.js:2830:7
    at /my-project/node_modules/neo-async/async.js:6877:13
    at /my-project/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/NormalModuleFactory.js:214:25
    at /my-project/node_modules/enhanced-resolve/lib/Resolver.js:213:14
    at /my-project/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /my-project/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
    at /my-project/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /my-project/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/my-project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /my-project/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
resolve 'utils/test-utils' in '/my-project/src/my-code'
  Parsed request is a module
  using description file: /my-project/package.json (relative path: ./src/my-code)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /my-project/src/my-code/node_modules doesn't exist or is not a directory
      /my-project/src/pages/living-app/screens/node_modules doesn't exist or is not a directory
      /my-project/src/pages/living-app/node_modules doesn't exist or is not a directory
      /my-project/src/pages/node_modules doesn't exist or is not a directory
      /my-project/src/node_modules doesn't exist or is not a directory
      /Users/cx01885/Workspace/living-apps/node_modules doesn't exist or is not a directory
      /Users/cx01885/Workspace/node_modules doesn't exist or is not a directory
      /Users/cx01885/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /my-project/node_modules
        using description file: /my-project/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /my-project/package.json (relative path: ./node_modules/utils/test-utils)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
      looking for modules in /my-project/node_modules
        No description file found
        Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils doesn't exist
            .web.mjs
              Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.web.mjs doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.mjs doesn't exist
            .web.js
              Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.web.js doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.js doesn't exist
            .web.ts
              Field 'browser' doesn't contain a valid alias configuration
        No description file found
        no extension
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.web.ts doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils doesn't exist
        .web.mjs
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.ts doesn't exist
            .web.tsx
              Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.web.mjs doesn't exist
        .mjs
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.web.tsx doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.mjs doesn't exist
        .web.js
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.web.js doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.json doesn't exist
            .web.jsx
              Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.js doesn't exist
        .web.ts
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.web.jsx doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.web.ts doesn't exist
        .ts
          Field 'browser' doesn't contain a valid alias configuration
              /my-project/node_modules/utils/test-utils.jsx doesn't exist
          /my-project/node_modules/utils/test-utils.ts doesn't exist
        .web.tsx
          Field 'browser' doesn't contain a valid alias configuration
            as directory
              /my-project/node_modules/utils/test-utils doesn't exist
          /my-project/node_modules/utils/test-utils.web.tsx doesn't exist
        .tsx
          Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.tsx doesn't exist
        .json
          Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.json doesn't exist
        .web.jsx
          Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.web.jsx doesn't exist
        .jsx
          Field 'browser' doesn't contain a valid alias configuration
          /my-project/node_modules/utils/test-utils.jsx doesn't exist
        as directory
          /my-project/node_modules/utils/test-utils do
...

Environment

  • OS: macOs
  • Node.js version: v14.18.2
  • NPM version: 6.14.15
  • Browser (if applicable): --
  • Browser version (if applicable): --
  • Device (if applicable): --
@manuartero manuartero added the bug Something isn't working label Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant