Last active
December 19, 2017 06:30
-
-
Save biswajitpaul01/4d70c4f37e861444723e59c792321bff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Serve from current directory without Babel-JS & Webpack | |
> browser-sync start --proxy "127.0.0.1" --directory --files "**/*" | |
# Babel JS | |
> npm install webpack -g | |
> npm init | |
> npm install webpack --save-dev | |
> webpack assets/js/app.js assets/js/app.bundle.js [Part 1] | |
> npm install babel-core babel-loader babel-preset-env --save-dev | |
# Create root file: .babelrc | |
{ "presets": [ "env" ] } | |
# Browsersync with webpack | |
> npm install browser-sync-webpack-plugin --save-dev | |
# Create root file: webpack.config.js | |
const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
module.exports = { | |
entry: './assets/js/app.js', | |
output: { | |
filename: './assets/js/app.compiled.js' | |
}, | |
watch: true, | |
plugins: [ | |
new BrowserSyncPlugin({ | |
host: 'localhost', | |
port: 3000, | |
proxy: "127.0.0.1", | |
files: "**/*" | |
}), | |
new UglifyJsPlugin({ | |
test: /\.js($|\?)/i | |
}) | |
], | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
use: 'babel-loader', | |
exclude: [ | |
/node_modules/ | |
] | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment