Nuxt.js: Can I use decorators in Nuxt.js ?

Created on 12 Oct 2017  路  3Comments  路  Source: nuxt/nuxt.js

Hi, I'm trying to use decorators in Nuxt.js.
I tried to edit .babelrc by setting build.babel.babelrc to true, and adding a babelrc that includes the babel-plugin-transform-decorators as a plugin.
But the compilation did not work though.

Is it because the Node.js do not support decorators yet so that I could not use decorator in SSR?

This question is available on Nuxt.js community (#c1651)
help-wanted

Most helpful comment

It works for me.

npm install --save-dev babel-plugin-transform-decorators-legacy

nuxt.config.js

build: {
  babel: {
    plugins: ['babel-plugin-transform-decorators-legacy']
  }
}

All 3 comments

It works for me.

npm install --save-dev babel-plugin-transform-decorators-legacy

nuxt.config.js

build: {
  babel: {
    plugins: ['babel-plugin-transform-decorators-legacy']
  }
}

@dotneet Thanks, it works now.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

o-alexandrov picture o-alexandrov  路  3Comments

bimohxh picture bimohxh  路  3Comments

vadimsg picture vadimsg  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

maicong picture maicong  路  3Comments