Now.sh build breaking due to: Support for the experimental syntax 'decorators-legacy' isn't currently enabled

前端 未结 3 594
别那么骄傲
别那么骄傲 2021-01-29 03:15

Expected:

After adding decko (Support for decorators) as well as adding support for experimetalDecoractors in my tsconfig.js

相关标签:
3条回答
  • 2021-01-29 03:31

    Just figured it out, I needed to add the plugin to the production part of my config for the build to work X_x

    {
      "env": {
        "development": {
          "presets": [
            "next/babel",
            "@zeit/next-typescript/babel"
          ],
          "plugins": [
            [
              "styled-components",
              {
                "ssr": true,
                "displayName": true
              }
            ],
            [
              "@babel/plugin-proposal-decorators",
              {
                "legacy": true
              }
            ]
          ]
        },
        "production": {
          "presets": [
            "next/babel",
            "@zeit/next-typescript/babel"
          ],
          "plugins": [
            [
              "styled-components",
              {
                "ssr": true,
                "displayName": true
              }
            ],
            [
              "@babel/plugin-proposal-decorators",
              {
                "legacy": true
              }
            ]
          ]
        },
    
    0 讨论(0)
  • 2021-01-29 03:44

    i'm seeing something similar on my end, but i think you can do this:

    {
      "presets": ["next/babel"],
      "plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]],
      "env": {...}
    }
    

    Seems like you can have global plugins for all the things, vs setting it all up for each one. would be yawnsome otherwise.

    0 讨论(0)
  • 2021-01-29 03:50

    Note for Next.JS NX users, there is currently an open (12/2020) issue for this error on their github at: github.com/nrwl/nx/issues/3322

    I have tried to fix this problem using several solutions in combination, but have not succeeded yet.

    0 讨论(0)
提交回复
热议问题