maputnik/webpack.production.config.js

99 lines
2.4 KiB
JavaScript
Raw Normal View History

2015-06-15 15:21:19 +02:00
var webpack = require('webpack');
var path = require('path');
var loaders = require('./webpack.loaders');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var WebpackCleanupPlugin = require('webpack-cleanup-plugin');
// local css modules
loaders.push({
test: /[\/\\]src[\/\\].*\.css/,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]')
2015-06-15 15:21:19 +02:00
});
// local scss modules
loaders.push({
test: /[\/\\]src[\/\\].*\.scss/,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', 'sass')
2015-06-15 15:21:19 +02:00
});
// global css files
loaders.push({
test: /[\/\\](node_modules|global)[\/\\].*\.css$/,
loader: ExtractTextPlugin.extract('style', 'css')
2015-06-15 15:21:19 +02:00
});
module.exports = {
entry: {
app: './src/index.jsx',
vendor: [
'file-saver',
'immutable',
'mapbox-gl',
//TODO: Cannot resolve migrations file?
//"mapbox-gl-style-spec",
2016-12-20 11:44:22 +01:00
"radium",
"randomcolor",
'react',
"react-dom",
2016-12-20 11:44:22 +01:00
"react-color",
"react-file-reader-input",
//TODO: Icons raise multi vendor errors?
//"react-icons",
// Open Layers
'openlayers',
'ol-mapbox-style'
]
},
output: {
path: path.join(__dirname, 'public'),
filename: '[chunkhash].app.js'
},
resolve: {
alias: {
'webworkify': 'webworkify-webpack',
},
extensions: ['', '.js', '.jsx']
},
module: {
loaders,
postLoaders: [{
include: /node_modules\/mapbox-gl-shaders/,
loader: 'transform',
query: 'brfs'
}]
},
node: {
2016-12-19 11:33:13 +01:00
fs: "empty",
net: 'empty',
tls: 'empty'
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', '[chunkhash].vendor.js'),
new WebpackCleanupPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true,
drop_console: true,
drop_debugger: true
}
}),
new webpack.optimize.OccurenceOrderPlugin(),
new ExtractTextPlugin('[contenthash].css', {
allChunks: true
}),
new HtmlWebpackPlugin({
template: './src/template.html',
title: 'Maputnik'
}),
new webpack.optimize.DedupePlugin()
]
2015-06-15 15:21:19 +02:00
};