Skip to content

Instantly share code, notes, and snippets.

@jbenner-radham
Created February 18, 2018 20:35
Show Gist options
  • Save jbenner-radham/bf3ca66e3e2908cd0bcf3d6c1bd8e7c4 to your computer and use it in GitHub Desktop.
Save jbenner-radham/bf3ca66e3e2908cd0bcf3d6c1bd8e7c4 to your computer and use it in GitHub Desktop.
A minimal webpack setup for bundling JS for browsers via Babel.
'use strict';
const path = require('path');
module.exports = {
/** @see https://webpack.js.org/configuration/entry-context/#entry */
entry: './src/js/index.js',
/** @see https://webpack.js.org/configuration/output/ */
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
/** @see https://webpack.js.org/configuration/devtool/ */
devtool: 'source-map',
/** @see https://webpack.js.org/configuration/resolve/ */
resolve: {
extensions: ['.js']
},
/** @see https://webpack.js.org/configuration/module/ */
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
options: {
presets: ['env']
},
exclude: /node_modules/
}
]
}
}
@jbenner-radham
Copy link
Author

Prerequisite install: yarn add --dev babel-core babel-preset-env babel-loader webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment