Skip to content

Instantly share code, notes, and snippets.

@darklight721
Created August 29, 2015 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darklight721/f2c8d496529738586c68 to your computer and use it in GitHub Desktop.
Save darklight721/f2c8d496529738586c68 to your computer and use it in GitHub Desktop.
Sample webpack config with promise/fetch shimming
{
"name": "SampleWebpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"webpack": "./node_modules/.bin/webpack",
"bundle": "npm run webpack -- -p",
"start": "npm run webpack -- -d --watch"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^5.8.23",
"babel-loader": "^5.3.2",
"exports-loader": "^0.6.2",
"promise": "^7.0.4",
"webpack": "^1.12.0",
"whatwg-fetch": "^0.9.0"
}
}
var webpack = require('webpack');
module.exports = {
entry: {
monitors: './monitors/',
patients: './patients/'
},
output: {
path: './bundles/',
filename: '[name].js'
},
resolve: {
alias: {
root: __dirname
}
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
}
]
},
plugins: [
new webpack.ProvidePlugin({
'Promise': 'promise/lib/es6-extensions',
'fetch': 'exports?window.fetch!whatwg-fetch'
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment