Skip to content

Instantly share code, notes, and snippets.

@vijaydeepak-tt
Last active December 13, 2017 15:04
Show Gist options
  • Save vijaydeepak-tt/8126e8b5ac0a5370b59b842c8fd419ce to your computer and use it in GitHub Desktop.
Save vijaydeepak-tt/8126e8b5ac0a5370b59b842c8fd419ce to your computer and use it in GitHub Desktop.
Required files and details
Installation:
npm i --save-dev webpack
npm i --save-dev babel-core babel-loader webpack-dev-server babel-preset-es2015 babel-polyfill
Html:
/build/index.html
<script src='bundle.js'></script>
Code be in
/app/index.js
Webpack Configuration:
const path = require('path');
module.exports = {
entry: ['./app/index.js'],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'bundle.js',
},
module: {
loaders: {
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}
},
devServer: {
port: 3000,
contentBase: path.resolve(__dirname, 'build'),
inline: true
}
}
Package.json:
{
"name": "es6-learnings",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"start": "webpack-dev-server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"babel": {
"presets": [
"es2015"
]
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.9.7"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment