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

Module parse failed: Identifier '_templateObject' #6494

Closed
HashemKhalifa opened this issue Nov 21, 2022 · 3 comments
Closed

Module parse failed: Identifier '_templateObject' #6494

HashemKhalifa opened this issue Nov 21, 2022 · 3 comments

Comments

@HashemKhalifa
Copy link

Describe the bug

using SWC with storybook getting this error

ERR! Module parse failed: Identifier '_templateObject' has already been declared (100:9)
ERR! File was processed with these loaders:
ERR!  * ./node_modules/storybook-addon-swc/node_modules/swc-loader/src/index.js
ERR!  * ./node_modules/swc-loader/src/index.js
ERR! You may need an additional loader to handle the result of these loaders.
ERR! |     return data;
ERR! | }
ERR! > function _templateObject() {
ERR! |     var data = _taggedTemplateLiteral([
ERR! |         "\n  background: ",

### Input code

_No response_

### Config

```json
{
  jsc: {
    parser: {
      syntax: 'typescript',
      jsx: true,
      dynamicImport: true,
      privateMethod: true,
      functionBind: true,
      exportDefaultFrom: true,
      exportNamespaceFrom: true,
      decorators: true,
      decoratorsBeforeExport: true,
      topLevelAwait: true,
      importMeta: true,
      preserveAllComments: false,
    },
    transform: {
      react: {
        runtime: 'automatic',
        development: !isProd,
        pragma: 'React.createElement',
        pragmaFrag: 'React.Fragment',
      },
      legacyDecorator: true,
      decoratorMetadata: true,
    },
    target: 'es2021',
    loose: false,
    externalHelpers: false,
    // Requires v1.2.50 or upper and requires target to be es2016 or upper.
    keepClassNames: false,
    experimental: {
      plugins: [
        [
          '@swc/plugin-styled-components',
          {
            fileName: !isProd,
            minify: isProd,
            ssr: true,
          },
        ],
        ['@swc/plugin-loadable-components', {}],
      ],
    },
  },
}

Playground link

No response

Expected behavior

the storybook build should pass!

Actual behavior

No response

Version

1.3.18

Additional context

No response

@kwonoj
Copy link
Member

kwonoj commented Nov 21, 2022

Please provide reproducible repo, with minimal codes input to isolate root cause.

@kdy1
Copy link
Member

kdy1 commented Nov 22, 2022

Closing as a duplicate of #5068

@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2022
@swc-bot
Copy link
Collaborator

swc-bot commented Dec 22, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Dec 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants