Created
December 9, 2015 19:04
-
-
Save leandrooriente/8416007b8c596d231b28 to your computer and use it in GitHub Desktop.
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'; | |
let webpack = require('webpack'); | |
let path = require('path'); | |
const dirname = __dirname.replace('/webpack', ''); | |
console.log(path.resolve(dirname, './node_modules/')); | |
let config = { | |
entry: [ | |
'webpack-hot-middleware/client', | |
'./index' | |
], | |
output: { | |
path: path.resolve(dirname, './'), | |
filename: 'id.bundle.js', | |
publicPath: '/static/' | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js?$/, | |
include: dirname, | |
loader: 'babel', | |
query: { | |
presets: ['es2015', 'stage-2', 'react'], | |
plugins: [ | |
[ | |
'react-transform', | |
{ | |
'transforms': [ | |
{ | |
'transform': 'react-transform-hmr', | |
'imports': ['react'], | |
'locals': ['module'] | |
}, | |
{ | |
'transform': 'react-transform-catch-errors', | |
'imports': ['react', 'redbox-react'] | |
} | |
] | |
} | |
] | |
] | |
}, | |
exclude: path.resolve(dirname, './node_modules/') | |
}, { | |
test: /\.scss$/, | |
loaders: ['style', 'css', 'sass'], | |
exclude: path.resolve(dirname, './node_modules/') | |
}, { | |
test: /\.css$/, | |
loader: 'style-loader!css-loader', | |
exclude: path.resolve(dirname, './node_modules/') | |
}, { | |
test: /\.(png|jpg|woff|ttf|eot|woff2)$/, | |
loader: 'url-loader?limit=100000', | |
exclude: path.resolve(dirname, './node_modules/') | |
}, { | |
test: /\.jpg$/, | |
loader: 'file-loader', | |
exclude: path.resolve(dirname, './node_modules/') | |
}, { | |
test: /\.json$/, | |
loader: 'json-loader', | |
exclude: path.resolve(dirname, './node_modules/') | |
} | |
] | |
}, | |
plugins: [ | |
new webpack.ProvidePlugin({ | |
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch' | |
}), | |
new webpack.optimize.OccurenceOrderPlugin(), | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NoErrorsPlugin(), | |
new webpack.DefinePlugin({ | |
__DEVELOPMENT__: true | |
}), | |
new webpack.DefinePlugin({ | |
'process.env': { | |
NODE_ENV: JSON.stringify('development') | |
} | |
}) | |
], | |
resolve: { | |
extensions: ['', '.js'], | |
alias: { | |
'styles': path.join(dirname, './styles'), | |
'components': path.join(dirname, './components'), | |
'containers': path.join(dirname, './containers'), | |
'actions': path.join(dirname, './actions'), | |
'constants': path.join(dirname, './constants'), | |
'reducers': path.join(dirname, './reducers'), | |
'utils': path.join(dirname, './utils') | |
} | |
}, | |
devtool: 'source-map', | |
watch: true, | |
quiet: true | |
}; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment