Thursday 1 June 2017

how to set up babel to publish module to npm?

everything is written in ES6 with babel and I'm struggling with publishing because of babel. I get I have to use prepublish to compile with babel but I'm not sure how to do it. I have a index.js file that imports every js file from lib folder. I think I have to compile all the js file in lib folder but not sure how to do it too. there's a directory tree and package.json below

{
  "main": "index.js",
  "scripts": {
    "start": "babel-node .",
    "build": "babel ", // not sure what to do here
    "prepublish": "npm build"
  },
  "bin": {
    "covfefe": "src/index.js" // compiled index.js path
  },
  "author": "Philip",
  "license": "ISC",
  "preferGlobal": true,
}

directory



via Phillip YS

No comments:

Post a Comment