@spicycoding/js-compiler
v1.1.0
Published
This package compiles your javascript and transforms it using the .babelrc file which you should add to the root of your project.
Downloads
1
Maintainers
Readme
@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
Developmentnode ./node_modules/@spicycoding/js-compiler/src/cli.js build --target ./resources/assets/js/app.js --destination ./public/dist/app.js
Watchernode ./node_modules/@spicycoding/js-compiler/src/cli.js watch --target ./resources/assets/js/app.js --destination ./public/dist/app.js
Productionnode ./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
}
]
]
}