Skip to content

Using Babel Plugin for Decorators #1451

Answered by c-classen
dresch86 asked this question in Q&A
Discussion options

You must be logged in to vote

After bumping into this issue myself, spending a lot of time searching for a solution and then looking at the definition of the defineConfig function here, I think I figured it out. You can actually add a solid property to the object you are passing to defineConfig which can have a babel property containing the required plugin configuration:

export default defineConfig({
  [...],
  solid: {
    babel: {
      plugins: [["@babel/plugin-syntax-decorators", {legacy: true}]]
    }
  } as any
});

The as any seems to be needed as there are some properties that are required in the object assigned to solid, but in the defineConfig function, the default for the object is the empty object, so that …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dresch86
Comment options

Answer selected by dresch86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants