Thursday, 18 May 2017

Transpiling next.js server code

I have a fresh install of Next.js and am wanting to be able to use import and async/await etc.

I have updated my .babelrc

{
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["."],
        "alias": {
          "styles": "./styles"
        },
        "cwd": "babelrc"
      }
    ],
    [
      "wrap-in-js",
      {
        "extensions": ["css$"]
      }
    ]
  ],
  "presets": [
    "next/babel",
    "es2015",
    "stage-0",
  ],
  "ignore": []
}

I assume I need to update some config to ./server.js?

Also how do I get around starting my app as I can point my start script to run from ./dist/server but I believe the server needs to run to be able to run a build?



via Stretch0

No comments:

Post a Comment