1.1.0 • Published 5 years ago

@spicycoding/js-compiler v1.1.0

Weekly downloads
12
License
MIT
Repository
-
Last release
5 years ago

@spicycoding/js-compiler
This compiler has three main functionalities:

  • Compile JS code and write it to the ./public/dist/ folder
  • Watch for changes in the ./resources/assets/js/ folder
  • Minifies code when using the --minify flag

How to use
Install using NPM: npm install @spicycoding/js-compiler
Install using Yarn: yarn add @spicycoding/js-compiler

Development
node ./node_modules/@spicycoding/js-compiler/src/cli.js build --target ./resources/assets/js/app.js --destination ./public/dist/app.js

Watcher
node ./node_modules/@spicycoding/js-compiler/src/cli.js watch --target ./resources/assets/js/app.js --destination ./public/dist/app.js

Production
node ./node_modules/@spicycoding/js-compiler/src/cli.js build --target ./resources/assets/js/app.js --destination ./public/dist/app.js --minify

Transform using babel

You can transform the output to support older browser by creating a .babelrc file which you should put in your project root. Example file:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": [
            "last 3 versions",
            "> 2%"
          ]
        },
        "useBuiltIns": "usage",
        "corejs": "core-js@3",
        "debug": false
      }
    ]
  ]
}