Created
January 2, 2017 18:23
-
-
Save rosskevin/da99def9e7be592d18f54cb321ec0c90 to your computer and use it in GitHub Desktop.
Development webpack config - http://stackoverflow.com/questions/41420329/consuming-pure-es2015-libraries-with-webpack-2
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
const config = { | |
devtool: 'source-map', | |
devServer: { | |
port: 3808, | |
headers: { | |
'Access-Control-Allow-Origin': '*' | |
} | |
}, | |
context: '/Users/kross/projects/af/spec/dummy', | |
entry: { | |
application: [ | |
'react-hot-loader/patch', | |
'webpack-dev-server/client?http://localhost:3808', | |
'webpack/hot/only-dev-server', | |
'./ui/src/index.js' | |
], | |
vendor: [ | |
'@alienfast/material-ui', | |
'classnames', | |
'cookie', | |
'core-js', | |
'dom-helpers', | |
'dompurify', | |
'es-collections', | |
'fbemitter', | |
'graphql', | |
'graphql-relay', | |
'i18next', | |
'i18next-browser-languagedetector', | |
'i18next-localstorage-cache', | |
'i18next-sprintf-postprocessor', | |
'jwt-decode', | |
'jss', | |
'jss-camel-case', | |
'jss-compose', | |
'jss-default-unit', | |
'jss-expand', | |
'jss-global', | |
'jss-nested', | |
'jss-preset-default', | |
'jss-props-sort', | |
'jss-theme-reactor', | |
'key.js', | |
'lodash', | |
'material-ui', | |
'md5', | |
'query-string', | |
'react', | |
'react-dom', | |
'react-formal', | |
'react-helmet', | |
'react-i18next', | |
'react-relay', | |
'react-relay-network-layer', | |
'react-router', | |
'react-router-relay', | |
'react-sizeme', | |
'react-tap-event-plugin', | |
'recompose', | |
'ua-parser-js', | |
'whatwg-fetch', | |
'yup' | |
] | |
}, | |
output: { | |
path: '/Users/kross/projects/af/spec/dummy/public/webpack', | |
publicPath: '//localhost:3808/webpack/', | |
filename: '[name].js' | |
}, | |
resolve: { | |
extensions: [ | |
'.js', | |
'.jsx', | |
'.json' | |
], | |
alias: { | |
react: '/Users/kross/projects/af/spec/dummy/node_modules/react', | |
'react-relay': '/Users/kross/projects/af/spec/dummy/node_modules/react-relay' | |
} | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
include: [ | |
'/Users/kross/projects/af/spec/dummy/ui/src', | |
'/Users/kross/projects/af/spec/dummy/ui/tests', | |
'/Users/kross/projects/af/spec/dummy/node_modules/react', | |
'/Users/kross/projects/af/spec/dummy/node_modules/react-relay' | |
], | |
exclude: /node_modules\/(?!(react|react-relay)\/).*/, | |
loaders: [ | |
'happypack/loader' | |
] | |
}, | |
{ | |
test: /\.json$/, | |
loader: 'json-loader' | |
}, | |
{ | |
test: /\.svg(\?.*)?$/, | |
loader: 'url-loader?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=image/svg+xml' | |
}, | |
{ | |
test: /\.(png|jpg)$/, | |
loader: 'url-loader?limit=8192' | |
} | |
] | |
}, | |
plugins: [ | |
new HappyPack({ loaders: [ 'babel-loader' ] }), | |
new webpack.DefinePlugin({ | |
NODE_ENV: 'development', | |
__DEV__: true, | |
__PROD__: false, | |
__TEST__: false, | |
ENV: 'development', | |
'process.env': { | |
NODE_ENV: '"development"' | |
} | |
}), | |
new StatsPlugin('manifest.json', { | |
// We only need assetsByChunkName | |
chunkModules: false, | |
source: false, | |
chunks: false, | |
modules: false, | |
assets: true | |
}), | |
new webpack.NoErrorsPlugin(), | |
new webpack.optimize.OccurrenceOrderPlugin(), | |
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 15 }), | |
new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 10000 }), | |
new webpack.optimize.CommonsChunkPlugin({ | |
names: [ 'vendor', 'manifest' ] // Specify the common bundle's name. | |
}) | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment