Created
January 1, 2015 17:38
-
-
Save flarnie/19e2cb1989e74910d955 to your computer and use it in GitHub Desktop.
Basic Webpack Config
This file contains 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
/* global __dirname */ | |
var webpack = require('webpack'); | |
module.exports = { | |
// for every key under 'entry', a JS file will be built | |
entry: { | |
bundle: './src/main.js.jsx' | |
}, | |
output: { | |
path: __dirname + '/public/javascripts', | |
filename: '[name].js' | |
}, | |
resolve: { | |
// places it looks for JS modules when not prefixed with './' | |
modulesDirectories: [ | |
__dirname + '/src', | |
'node_modules' | |
], | |
extensions: [ | |
'', | |
'.js', | |
'.jsx', | |
'.js.jsx' | |
] | |
}, | |
externals: { | |
// This will allow loading jQuery via CDN | |
// jQuery is available via "require('jquery')" | |
jquery: 'var jQuery' | |
}, | |
devtool: 'eval-source-map', | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
loader: 'es6-loader' | |
}, | |
{ | |
test: /\.jsx$/, | |
loader: 'jsx-loader' | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment