Skip to content

Instantly share code, notes, and snippets.

@gauravchl
Last active January 14, 2018 07:41
Show Gist options
  • Select an option

  • Save gauravchl/b09369a21f7b34c88c1fa9f505b4024e to your computer and use it in GitHub Desktop.

Select an option

Save gauravchl/b09369a21f7b34c88c1fa9f505b4024e to your computer and use it in GitHub Desktop.
webpack setups
/* Just for es6 */
{
"name": "webapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch --progress",
"build": "webpack -p"
},
"author": "",
"license": "ISC",
"dependencies": {
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"webpack": "^3.10.0"
}
}
var path = require('path');
var webpack = require('webpack');
var SRC_DIR = path.resolve(__dirname, 'src');
var ROOT_DIR = path.resolve(__dirname, '');
config = {
entry: [ 'babel-polyfill', SRC_DIR + '/index.js' ],
output: {
path: ROOT_DIR,
filename: 'index.js',
},
module: {
loaders: [
{
test: /\.js|\.jsx$/,
include: [SRC_DIR],
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: [ 'es2015', 'babel-preset-env' ],
plugins: [ 'transform-es2015-destructuring', 'transform-object-rest-spread' ]
}
},
],
},
resolve: {
modules: [ SRC_DIR, path.resolve('./node_modules') ]
},
}
module.exports = [config];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment