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.

Using lerna, babel cannot resolve packages

See original GitHub issue

Describe the bug

Module parse failed: Unexpected token (42:24)
File was processed with these loaders:
 * ./node_modules/@storybook/source-loader/dist/server/index.js
You may need an additional loader to handle the result of these loaders.
| 
| storiesOf("Task", module).addParameters({ storySource: { source: __STORY__, locationsMap: __ADDS_MAP__ } }).addDecorator(withSourceLoader(__STORY__, __ADDS_MAP__,__MAIN_FILE_LOCATION__,__MODULE_DEPENDENCIES__,__LOCAL_DEPENDENCIES__,__SOURCE_PREFIX__,__IDS_TO_FRAMEWORKS__))
>   .add("default", () => <Task task={task} {...actions} />)
|   .add("pinned", () => (
|     <Task task={{ ...task, state: "TASK_PINNED" }} {...actions} />
Error: Module parse failed: Unexpected token (42:24)
File was processed with these loaders:
 * ./node_modules/@storybook/source-loader/dist/server/index.js
You may need an additional loader to handle the result of these loaders.
| 
| storiesOf("Task", module).addParameters({ storySource: { source: __STORY__, locationsMap: __ADDS_MAP__ } }).addDecorator(withSourceLoader(__STORY__, __ADDS_MAP__,__MAIN_FILE_LOCATION__,__MODULE_DEPENDENCIES__,__LOCAL_DEPENDENCIES__,__SOURCE_PREFIX__,__IDS_TO_FRAMEWORKS__))
>   .add("default", () => <Task task={task} {...actions} />)
|   .add("pinned", () => (
|     <Task task={{ ...task, state: "TASK_PINNED" }} {...actions} />
    at Object../packages/common/src/Task.stories.js (http://localhost:9009/main.e20d7b02cd69e0990a98.bundle.js:100:7)
    at __webpack_require__ (http://localhost:9009/runtime~main.e20d7b02cd69e0990a98.bundle.js:785:30)
    at fn (http://localhost:9009/runtime~main.e20d7b02cd69e0990a98.bundle.js:151:20)
    at webpackContext (http://localhost:9009/main.e20d7b02cd69e0990a98.bundle.js:74:9)
    at http://localhost:9009/vendors~main.e20d7b02cd69e0990a98.bundle.js:26595:29
    at Array.forEach (<anonymous>)
    at http://localhost:9009/vendors~main.e20d7b02cd69e0990a98.bundle.js:26594:20
    at Array.forEach (<anonymous>)
    at http://localhost:9009/vendors~main.e20d7b02cd69e0990a98.bundle.js:26593:12
    at ConfigApi.configure (http://localhost:9009/vendors~main.e20d7b02cd69e0990a98.bundle.js:23463:7)

Code snippets

module.exports = {
  stories: ["../packages/**/*.stories.(js|mdx)"],
  addons: [
    "@storybook/addon-actions",
    "@storybook/addon-links",
    "@storybook/preset-create-react-app",
    {
      name: "@storybook/addon-docs",
      options: {
        configureJSX: true
      }
    }
  ]
};

System: npx -p @storybook/cli@next sb init -p babel ts tsx --story-format mdx Additional context

  • @storybook 6.0.0-alpha.31

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
BartJanvanAssencommented, Aug 28, 2020

Any suggestion yet on a solution or workaround @astrotim ?

1reaction
astrotimcommented, Jun 29, 2020

Keeping this issue alive as I’m still hoping for a solution to be found.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - lerna + webpack + babel-loader issue - Stack Overflow
One nice thing about using Lerna is you can pull devDependencies up to the repo root to factor them out of the individual...
Read more >
Managing Monorepo using Lerna and Yarn workspaces
In this article, what we call "Monorepo" is a way to manage multiple npm packages in a single repository. Babel, Jest, and Create...
Read more >
Creating Monorepo using Lerna - Medium
Note — This Blog explains the monorepo creation from scratch using Lerna and focuses on some of the basic issues you can face...
Read more >
Can't add local package in a monorepo lerna project - Support
I have a monorepo that uses yarn workspaces + lerna. In my “frontend” package, I want to add the “tsdx-test” which is another...
Read more >
Managing Your Typescript Monorepo With Lerna and Codefresh
Additionally, you cannot necessarily use the same tools and processes ... This will create a Lerna configuration file and a package folder, ...
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