Main config in typescript throwing error with export default
See original GitHub issueDescribe the bug main.ts with typescript export default breaks
To Reproduce
- rename your config if it’s in js to ts and have something like
export default {
addons: ['@storybook/addon-docs', '@storybook/addon-knobs'],
};
Expected behavior No error produced and server starts
Screenshots
info @storybook/web-components v6.0.0-beta.35
info
WARN Unable to close preview build!
ERR! /hello-web-components/.storybook/main.ts:1
ERR! export default {
ERR! ^^^^^^
ERR!
ERR! SyntaxError: Unexpected token 'export'
ERR! at compileFunction (<anonymous>)
ERR! at Object.compileFunction (vm.js:344:18)
ERR! at wrapSafe (internal/modules/cjs/loader.js:1106:15)
ERR! at Module._compile (internal/modules/cjs/loader.js:1140:27)
ERR! at Module._compile (/hello-web-components/node_modules/pirates/lib/index.js:99:24)
ERR! at Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
ERR! at Object.newLoader [as .ts] (/hello-web-components/node_modules/pirates/lib/index.js:104:7)
ERR! at Module.load (internal/modules/cjs/loader.js:1040:32)
ERR! at Function.Module._load (internal/modules/cjs/loader.js:929:14)
ERR! at Module.require (internal/modules/cjs/loader.js:1080:19)
ERR! at require (internal/modules/cjs/helpers.js:72:18)
ERR! at interopRequireDefault (/hello-web-components/node_modules/@storybook/core/dist/server/utils/server-require.js:66:16)
ERR! at serverRequire (/hello-web-components/node_modules/@storybook/core/dist/server/utils/server-require.js:103:10)
ERR! at loadCustomPresets (/hello-web-components/node_modules/@storybook/core/dist/server/common/custom-presets.js:21:47)
ERR! at _default (/hello-web-components/node_modules/@storybook/core/dist/server/manager/manager-config.js:146:143)
ERR! at _default (/hello-web-components/node_modules/@storybook/core/dist/server/dev-server.js:59:51)
ERR! /hello-web-components/.storybook/main.ts:1
ERR! export default {
ERR! ^^^^^^
ERR!
ERR! SyntaxError: Unexpected token 'export'
ERR! at compileFunction (<anonymous>)
ERR! at Object.compileFunction (vm.js:344:18)
ERR! at wrapSafe (internal/modules/cjs/loader.js:1106:15)
ERR! at Module._compile (internal/modules/cjs/loader.js:1140:27)
ERR! at Module._compile (/hello-web-components/node_modules/pirates/lib/index.js:99:24)
ERR! at Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
ERR! at Object.newLoader [as .ts] (/hello-web-components/node_modules/pirates/lib/index.js:104:7)
ERR! at Module.load (internal/modules/cjs/loader.js:1040:32)
ERR! at Function.Module._load (internal/modules/cjs/loader.js:929:14)
ERR! at Module.require (internal/modules/cjs/loader.js:1080:19)
ERR! at require (internal/modules/cjs/helpers.js:72:18)
ERR! at interopRequireDefault (/hello-web-components/node_modules/@storybook/core/dist/server/utils/server-require.js:66:16)
ERR! at serverRequire (/hello-web-components/node_modules/@storybook/core/dist/server/utils/server-require.js:103:10)
ERR! at loadCustomPresets (/hello-web-components/node_modules/@storybook/core/dist/server/common/custom-presets.js:21:47)
ERR! at _default (/hello-web-components/node_modules/@storybook/core/dist/server/manager/manager-config.js:146:143)
ERR! at _default (/hello-web-components/node_modules/@storybook/core/dist/server/dev-server.js:59:51)
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
"Export Default" in React Native Typescript causing Parsing ...
The issue seems to be stemming from using export default in Typescript to export my component (happens both with or without connection to...
Read more >TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >Documentation - Modules - TypeScript
Each module can optionally export a default export. Default exports are marked with the keyword default ; and there can only be one...
Read more >TypeScript - webpack
In this guide we will learn how to integrate TypeScript with webpack. Basic Setup. First install the TypeScript compiler and loader by running:...
Read more >Configuring Jest
The configuration file should simply export an object: JavaScript; TypeScript. /** @type {import('jest').Config} */
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Related: https://github.com/storybookjs/storybook/issues/8936
thanks to #11759 there’s no need for this one anymore