question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding `webpackFinal` to storybook config breaks storybook startup ("Field 'browser' doesn't contain a valid alias configuration")

See original GitHub issue

Following https://storybook.js.org/docs/react/configure/webpack i added a webpackFinal section into storybook.config.js. However, as soon as that section is included (even without any modifications to the webpack config whatsoever), storybook won’t start anymore.

So as soon as i add


// storybook.config.js

module.exports = {
  // ...
  webpackFinal: async (config, { configType }) => {
    return config
  },
}

yarn rw storybook breaks in the last few percent of the startup process with:

Expand for error log
99% done plugins webpack-hot-middlewarewebpack built preview 32f6db39dd6883a49734 in 21884ms
ModuleNotFoundError: Module not found: Error: Can't resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
	- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "http": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/http)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/http doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
	- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "http": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/http)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/http doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'https' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
	- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "https": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'https' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/https)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/https.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/https doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
	- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "http": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest/utils)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/http)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/http.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/http doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'stream' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "stream": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'stream' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest/utils)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/stream)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/stream doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'stream' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "stream": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'stream' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest/utils)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/stream)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/stream.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/stream doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'zlib' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
	- install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "zlib": false }
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/Compilation.js:2015:28
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/phil/prog/interview-tool/interviewtool/node_modules/neo-async/async.js:6883:13
    at /home/phil/prog/interview-tool/interviewtool/node_modules/webpack/lib/NormalModuleFactory.js:958:45
    at finishWithoutResolve (/home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/phil/prog/interview-tool/interviewtool/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/phil/prog/interview-tool/interviewtool/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve 'zlib' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'
  Parsed request is a module
  using description file: /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/package.json (relative path: ./lib/interceptors/ClientRequest/utils)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/node_modules doesn't exist or is not a directory
      /home/phil/prog/interview-tool/interviewtool/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/phil/prog/interview-tool/interviewtool/node_modules
        single file module
          using description file: /home/phil/prog/interview-tool/interviewtool/package.json (relative path: ./node_modules/zlib)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.jsx doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.tsx doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.json doesn't exist
            .cjs
              Field 'browser' doesn't contain a valid alias configuration
              /home/phil/prog/interview-tool/interviewtool/node_modules/zlib.cjs doesn't exist
        /home/phil/prog/interview-tool/interviewtool/node_modules/zlib doesn't exist
      /home/phil/prog/interview-tool/node_modules doesn't exist or is not a directory
      /home/phil/prog/node_modules doesn't exist or is not a directory
      /home/phil/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
ModuleNotFoundError: Module not found: Error: Can't resolve 'http' in '/home/phil/prog/interview-tool/interviewtool/node_modules/@mswjs/interceptors/lib/interceptors/ClientRequest/utils'

{{multiple repetitions of same error for various components}}

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

As the full error log exceeds github’s 65536 char limit, i’m attaching the full log as a text-file here: storybook-webpackFinal-error.txt

Not sure if this comes down to a bug in storybook, or if it is due to the Redwood integration setup. I highly appreciate any comments.

XY-Problem statement

I was experimenting how to get rid of the “sourcemap not found” warnings in the dev console when running storybook:

grafik

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
0x15F9commented, Jul 6, 2022

Hello @dac09. Thanks for the workaround. I did something else that’s a bit hacky but it works. I configured the ‘run on save’ extension on VS Code to run lessc whenever I save my .less files 😃.

Keep up the good work 💪🏼

2reactions
dac09commented, Jul 5, 2022

I need to add custom rules as well to enable storybook to use LESS

Hello @0x15F9 - so we took a deeper look at this issue.

I wonder if you could include your LESS configuration in the webpack config, rather than storybook config?

yarn rw setup webpack - should create the webpack config file for you, where you can add your loader configuration here. Would this work for you while we look at resolving this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Field 'browser' doesn't contain a valid alias configuration
I tried adding a browser field to my package.json but that didn't seem to do any good. webpack.config.js import path from ' ...
Read more >
Configure Storybook
Storybook is configured via a folder called .storybook , which contains various configuration files. Note that you can change the folder that Storybook...
Read more >
Fix Field Browser Doesn't Contain a Valid Alias Configuration
1. Open the configuration file. config file code · 2. Here, locate the entry value. · 3. Add ./ character if it is...
Read more >
How to resolve a path alias in Storybook - +return
We have solved the path alias issue with CRA projects earlier, but we are likely going to encounter it again if we are...
Read more >
Angular 12 Support #14909 - Issuehunt
svpVK5CL/angular/.storybook" info => Adding stories defined in ... dist/esm) Field 'browser' doesn't contain a valid alias configuration resolve as module ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found