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.

Main config in typescript throwing error with export default

See original GitHub issue

Describe the bug main.ts with typescript export default breaks

To Reproduce

  1. 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:closed
  • Created 3 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, Jun 26, 2020
0reactions
fernandopasikcommented, Aug 2, 2020

thanks to #11759 there’s no need for this one anymore

Read more comments on GitHub >

github_iconTop 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 >

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