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

Webpack 5: Preview build fails, window/global #14407

Closed
irudoy opened this issue Mar 31, 2021 · 14 comments
Closed

Webpack 5: Preview build fails, window/global #14407

irudoy opened this issue Mar 31, 2021 · 14 comments

Comments

@irudoy
Copy link

irudoy commented Mar 31, 2021

Trying to upgrade the storybook to the latest version with webpack 5.

Upgrading from storybook@6.2.0-beta.14 and webpack@5.25.1. In this case, all works fine with no issues.
But with storybook@6.2.0 and webpack@5.28.0 I have some issues that were workaround by pinning webpack and other dependencies with resolutions, and removing DefinePlugin and Dotenv from final preview and manager configs.

But one issue still occurs, and I can't figure out what causes it.

ERR! => Failed to build the preview
ERR! export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)
ERR! export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)
ERR! export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)
WARN {
WARN   moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN   moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN   loc: '75:7-13',
WARN   message: "export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)",
WARN   moduleId: 5317,
WARN   moduleTrace: [
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       originName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN       dependencies: [Array],
WARN       originId: 5519,
WARN       moduleId: 5317
WARN     },
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       originName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       dependencies: [Array],
WARN       originId: null,
WARN       moduleId: 5519
WARN     },
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/register.js',
WARN       originName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/register.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       dependencies: [Array],
WARN       originId: null,
WARN       moduleId: null
WARN     }
WARN   ],
WARN   details: undefined,
WARN   stack: '    at HarmonyImportSpecifierDependency.getLinkingErrors (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:137:8)\n' +
WARN     '    at HarmonyImportSpecifierDependency._getErrors (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:184:15)\n' +
WARN     '    at HarmonyImportSpecifierDependency.getWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:160:15)\n' +
WARN     '    at Compilation.reportDependencyErrorsAndWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2463:24)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2094:10\n' +
WARN     '    at _next2 (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)\n' +
WARN     '    at eval (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:343:11\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:322:18\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:46:16\n' +
WARN     '    at Hook.eval [as callAsync] (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:48:1)\n' +
WARN     '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/Hook.js:18:14)\n' +
WARN     '\n' +
WARN     "ModuleDependencyWarning: export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)\n" +
WARN     '    at Compilation.reportDependencyErrorsAndWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2468:23)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2094:10\n' +
WARN     '    at _next2 (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)\n' +
WARN     '    at eval (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:343:11\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:322:18\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:46:16\n' +
WARN     '    at Hook.eval [as callAsync] (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:48:1)\n' +
WARN     '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/Hook.js:18:14)\n' +
WARN     '    at Compilation.finish (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2087:28)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compiler.js:1073:19\n' +
WARN     '    at processTicksAndRejections (internal/process/task_queues.js:75:11)'
WARN }
WARN {
WARN   moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN   moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN   loc: '75:18-35',
WARN   message: "export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)",
WARN   moduleId: 5317,
WARN   moduleTrace: [
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       originName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN       dependencies: [Array],
WARN       originId: 5519,
WARN       moduleId: 5317
WARN     },
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       originName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       dependencies: [Array],
WARN       originId: null,
WARN       moduleId: 5519
WARN     },
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/register.js',
WARN       originName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/register.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       dependencies: [Array],
WARN       originId: null,
WARN       moduleId: null
WARN     }
WARN   ],
WARN   details: undefined,
WARN   stack: '    at HarmonyImportSpecifierDependency.getLinkingErrors (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:137:8)\n' +
WARN     '    at HarmonyImportSpecifierDependency._getErrors (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:184:15)\n' +
WARN     '    at HarmonyImportSpecifierDependency.getWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:160:15)\n' +
WARN     '    at Compilation.reportDependencyErrorsAndWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2463:24)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2094:10\n' +
WARN     '    at _next2 (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)\n' +
WARN     '    at eval (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:343:11\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:322:18\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:46:16\n' +
WARN     '    at Hook.eval [as callAsync] (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:48:1)\n' +
WARN     '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/Hook.js:18:14)\n' +
WARN     '\n' +
WARN     "ModuleDependencyWarning: export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)\n" +
WARN     '    at Compilation.reportDependencyErrorsAndWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2468:23)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2094:10\n' +
WARN     '    at _next2 (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)\n' +
WARN     '    at eval (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:343:11\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:322:18\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:46:16\n' +
WARN     '    at Hook.eval [as callAsync] (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:48:1)\n' +
WARN     '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/Hook.js:18:14)\n' +
WARN     '    at Compilation.finish (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2087:28)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compiler.js:1073:19\n' +
WARN     '    at processTicksAndRejections (internal/process/task_queues.js:75:11)'
WARN }
WARN {
WARN   moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN   moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN   loc: '76:29-46',
WARN   message: "export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)",
WARN   moduleId: 5317,
WARN   moduleTrace: [
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       originName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/utils.js',
WARN       dependencies: [Array],
WARN       originId: 5519,
WARN       moduleId: 5317
WARN     },
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       originName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-theming-virtual-cf22236d2e/0/cache/@storybook-theming-npm-6.2.0-19b73e8025-7366254077.zip/node_modules/@storybook/theming/dist/esm/index.js',
WARN       dependencies: [Array],
WARN       originId: null,
WARN       moduleId: 5519
WARN     },
WARN     {
WARN       originIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/register.js',
WARN       originName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/register.js',
WARN       moduleIdentifier: '/.../.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       moduleName: './.yarn/$$virtual/@storybook-addon-viewport-virtual-208331b40c/0/cache/@storybook-addon-viewport-npm-6.2.0-0b5ab8de75-1e51a9ab33.zip/node_modules/@storybook/addon-viewport/dist/esm/Tool.js',
WARN       dependencies: [Array],
WARN       originId: null,
WARN       moduleId: null
WARN     }
WARN   ],
WARN   details: undefined,
WARN   stack: '    at HarmonyImportSpecifierDependency.getLinkingErrors (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:137:8)\n' +
WARN     '    at HarmonyImportSpecifierDependency._getErrors (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:184:15)\n' +
WARN     '    at HarmonyImportSpecifierDependency.getWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:160:15)\n' +
WARN     '    at Compilation.reportDependencyErrorsAndWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2463:24)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2094:10\n' +
WARN     '    at _next2 (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)\n' +
WARN     '    at eval (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:343:11\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:322:18\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:46:16\n' +
WARN     '    at Hook.eval [as callAsync] (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:48:1)\n' +
WARN     '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/Hook.js:18:14)\n' +
WARN     '\n' +
WARN     "ModuleDependencyWarning: export 'window' (imported as 'window') was not found in 'global' (possible exports: createGlobal, createReset)\n" +
WARN     '    at Compilation.reportDependencyErrorsAndWarnings (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2468:23)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2094:10\n' +
WARN     '    at _next2 (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)\n' +
WARN     '    at eval (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:343:11\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:322:18\n' +
WARN     '    at /.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2830:7\n' +
WARN     '    at Object.each (/.../.yarn/cache/neo-async-npm-2.6.2-75d6902586-34a8f53091.zip/node_modules/neo-async/async.js:2850:39)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:46:16\n' +
WARN     '    at Hook.eval [as callAsync] (eval at create (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:48:1)\n' +
WARN     '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/.../.yarn/cache/tapable-npm-2.2.0-516ee6aa5b-f8ed725aed.zip/node_modules/tapable/lib/Hook.js:18:14)\n' +
WARN     '    at Compilation.finish (/.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compilation.js:2087:28)\n' +
WARN     '    at /.../.yarn/$$virtual/webpack-virtual-e76a084212/0/cache/webpack-npm-5.28.0-69f7066b52-bb1948e6a2.zip/node_modules/webpack/lib/Compiler.js:1073:19\n' +
WARN     '    at processTicksAndRejections (internal/process/task_queues.js:75:11)'
WARN }

┆Issue is synchronized with this Asana task by Unito

@shilman
Copy link
Member

shilman commented Apr 1, 2021

Do you have a repro repo you can share?

@shilman
Copy link
Member

shilman commented Apr 1, 2021

We think that there's something weird in your webpack config that's causing this line:

https://github.com/storybookjs/storybook/blob/master/lib/theming/src/utils.ts#L2

To try to import this file:

https://github.com/storybookjs/storybook/blob/master/lib/theming/src/global.ts

Whereas it should load node_modules/global package. If you could share your project, we might be able to narrow it down further.

@irudoy
Copy link
Author

irudoy commented Apr 2, 2021

It's quite a huge project. I'll try to reduce it keeping this issue reproducible.

@irudoy
Copy link
Author

irudoy commented Apr 2, 2021

@shilman done https://github.com/irudoy/sb-14407-repro

@irudoy
Copy link
Author

irudoy commented Apr 10, 2021

Friendly ping. Any news or ETA on this? Maybe I can help somehow?

@shilman
Copy link
Member

shilman commented Apr 11, 2021

@irudoy sorry for the slow response. i get a few different errors when i try to run your repro:

yarn
yarn build

=>

Module build failed: Error: ENOENT: no such file or directory, open '/Users/shilman/projects/baseline/storybook/addons/docs/dist/esm/register.js'
...
WARNING in ./src/stories/Test.stories.mdx
Module build failed (from /Users/shilman/projects/baseline/storybook/node_modules/@mdx-js/loader/index.js):
SyntaxError: Unexpected token (1:71)

As far as I can tell, these errors are not related to the original issue. Am I doing something wrong?

@irudoy
Copy link
Author

irudoy commented Apr 11, 2021

@shilman strange. I just tried from scratch: git clean -fdx && yarn && yarn build and have no issues like yours.
Also, I have no Test.stories.mdx in my repo https://github.com/irudoy/sb-14407-repro/tree/master/src
And why you have this path home/projects/baseline/storybook in your traces?

@shilman
Copy link
Member

shilman commented Apr 11, 2021

I'll try a clean build later. Thanks!

@shilman
Copy link
Member

shilman commented Apr 14, 2021

I have reproduced the problem on my machine. don't know what was happening earlier. @ndelangen and I played around with it to try to understand why this is happening, but didn't make any headway. We suspect it is a webpack bug related to resolution. Perhaps you can experiment with different versions?

@irudoy
Copy link
Author

irudoy commented Apr 15, 2021

@shilman played around with versions and determined that it starts breaking on v6.2.0-rc.4, that referencing only one change: #14271

@shilman
Copy link
Member

shilman commented Apr 15, 2021

I took a look and the error is still there on 6.2.0-rc.3. It just comes out as a warning instead of an error. I also needed to disable the 'util' fallback:

    finalConfig.resolve.fallback = {
      ...finalConfig.resolve.fallback,
      util: false,
    };

When i do that and try to view the page, I get a process.env.[SOMETHING] not defined, which means that the webpack define plugin isn't working, which makes sense because it's disabled in your main.js config

@irudoy
Copy link
Author

irudoy commented Apr 16, 2021

@shilman I has disabled Define and Dotenv plugins because of another issue. It used unneeded env vars from some dotenv files, that used for backend app purposes. Anyway, seems like it doesn't affect this issue.

Also, I don't clearly understand why you needed to disable the 'util' fallback.

And it definitely works fine on 6.2.0-rc.3. You can try it on this branch: https://github.com/irudoy/sb-14407-repro/tree/working

And another proof that mainFields causes this issue: https://github.com/irudoy/sb-14407-repro/tree/working-latest
I used latest SB and finalConfig.resolve.mainFields = ['browser', 'main'];. It works fine, you can check it by yourself.

Of course, mainFields is only the tip of a problem, and I'll try to investigate it deeper. It's possible that this is a webpack issue.

@irudoy
Copy link
Author

irudoy commented Apr 16, 2021

Some news. The issue is happening only when using yarn berry. It's good with npm.

@shilman shilman added the yarn / npm Yarn / npm acting weird label Apr 16, 2021
@shilman shilman removed this from the 6.3 webpack milestone Jun 8, 2021
@irudoy
Copy link
Author

irudoy commented Jun 16, 2021

Seems like this issue isn't happening in the latest 6.3 RC. Thanks!

@irudoy irudoy closed this as completed Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants