Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 750 Bytes

README.md

File metadata and controls

15 lines (12 loc) · 750 Bytes

MobX Sample with Next.js v7 & v8

Why creating the sample

Nearly all MobX samples recommand “transform-decorators-legacy” babel plug-in for supporting the decorator grammar. It works with next@6. When upgrading to Next@7 & Next@8, the babel plug-in “transform-decorators-legacy” is not available anymore. We have to look for the new plug-in(s) for the decorator grammar. So here is the sample.

The key point

The key point is in the .bablerc file. We have to use the two plug-ins below with the right arguments. And the order of the two lines cannot be changed.

// .babelrc
"plugins": [
  ["@babel/plugin-proposal-decorators", { "legacy": true }],
  ["@babel/plugin-proposal-class-properties", { "loose": true }]
]