Created
February 18, 2018 20:35
-
-
Save jbenner-radham/bf3ca66e3e2908cd0bcf3d6c1bd8e7c4 to your computer and use it in GitHub Desktop.
A minimal webpack setup for bundling JS for browsers via Babel.
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
'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/ | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisite install:
yarn add --dev babel-core babel-preset-env babel-loader webpack
.