Open elektronik2k5 opened 2 years ago
Hello and thanks for maintaining this plugin! 🙇🏻♀️
CRACO@6.4 added support for cosmiconfig based configuration, as well as TS based configuration. Currently this plugin fails to find a craco.config.ts file with this error:
craco.config.ts
ERR! Error: Cannot find module '/path/to/project/craco.config.js' ERR! Require stack: ERR! - /path/to/project/node_modules/storybook-preset-craco/index.js ERR! - /path/to/project/node_modules/@storybook/core-common/dist/cjs/presets.js ERR! - /path/to/project/node_modules/@storybook/core-common/dist/cjs/index.js ERR! - /path/to/project/node_modules/@storybook/core-server/dist/cjs/index.js ERR! - /path/to/project/node_modules/@storybook/core/dist/cjs/server.js ERR! - /path/to/project/node_modules/@storybook/core/server.js ERR! - /path/to/project/node_modules/@storybook/react/dist/cjs/server/index.js ERR! - /path/to/project/node_modules/@storybook/react/bin/index.js ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) ERR! at Function.Module._load (node:internal/modules/cjs/loader:778:27) ERR! at Module.require (node:internal/modules/cjs/loader:1005:19) ERR! at require (node:internal/modules/cjs/helpers:102:18) ERR! at Object.webpack (/path/to/project/node_modules/storybook-preset-craco/index.js:57:23) ERR! at /path/to/project/node_modules/@storybook/core-common/dist/cjs/presets.js:274:28 ERR! at async Object.start (/path/to/project/node_modules/@storybook/builder-webpack4/dist/cjs/index.js:95:16) ERR! at async Promise.all (index 0) ERR! at async storybookDevServer (/path/to/project/node_modules/@storybook/core-server/dist/cjs/dev-server.js:123:28) ERR! at async buildDevStandalone (/path/to/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:112:31) ERR! at async buildDev (/path/to/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:154:5) ERR! Error: Cannot find module '/path/to/project/craco.config.js' ERR! Require stack: ERR! - /path/to/project/node_modules/storybook-preset-craco/index.js ERR! - /path/to/project/node_modules/@storybook/core-common/dist/cjs/presets.js ERR! - /path/to/project/node_modules/@storybook/core-common/dist/cjs/index.js ERR! - /path/to/project/node_modules/@storybook/core-server/dist/cjs/index.js ERR! - /path/to/project/node_modules/@storybook/core/dist/cjs/server.js ERR! - /path/to/project/node_modules/@storybook/core/server.js ERR! - /path/to/project/node_modules/@storybook/react/dist/cjs/server/index.js ERR! - /path/to/project/node_modules/@storybook/react/bin/index.js ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) ERR! at Function.Module._load (node:internal/modules/cjs/loader:778:27) ERR! at Module.require (node:internal/modules/cjs/loader:1005:19) ERR! at require (node:internal/modules/cjs/helpers:102:18) ERR! at Object.webpack (/path/to/project/node_modules/storybook-preset-craco/index.js:57:23) ERR! at /path/to/project/node_modules/@storybook/core-common/dist/cjs/presets.js:274:28 ERR! at async Object.start (/path/to/project/node_modules/@storybook/builder-webpack4/dist/cjs/index.js:95:16) ERR! at async Promise.all (index 0) ERR! at async storybookDevServer (/path/to/project/node_modules/@storybook/core-server/dist/cjs/dev-server.js:123:28) ERR! at async buildDevStandalone (/path/to/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:112:31) ERR! at async buildDev (/path/to/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:154:5) { ERR! code: 'MODULE_NOT_FOUND', ERR! requireStack: [ ERR! '/path/to/project/node_modules/storybook-preset-craco/index.js', ERR! '/path/to/project/node_modules/@storybook/core-common/dist/cjs/presets.js', ERR! '/path/to/project/node_modules/@storybook/core-common/dist/cjs/index.js', ERR! '/path/to/project/node_modules/@storybook/core-server/dist/cjs/index.js', ERR! '/path/to/project/node_modules/@storybook/core/dist/cjs/server.js', ERR! '/path/to/project/node_modules/@storybook/core/server.js', ERR! '/path/to/project/node_modules/@storybook/react/dist/cjs/server/index.js', ERR! '/path/to/project/node_modules/@storybook/react/bin/index.js' ERR! ] ERR! }
Providing an options.cracoConfigFile for non native node files (TS) won't work either, of course.
options.cracoConfigFile
I think the code to supporting this functionality is mostly implemented in the original CRACO PR.
Thanks!
Hello and thanks for maintaining this plugin! 🙇🏻♀️
CRACO@6.4 added support for cosmiconfig based configuration, as well as TS based configuration. Currently this plugin fails to find a
craco.config.ts
file with this error:Providing an
options.cracoConfigFile
for non native node files (TS) won't work either, of course.I think the code to supporting this functionality is mostly implemented in the original CRACO PR.
Thanks!