mirror of
https://github.com/jlengrand/leaflet-geosearch.git
synced 2026-03-10 08:31:26 +00:00
50 lines
966 B
JavaScript
50 lines
966 B
JavaScript
import webpack from 'webpack';
|
|
import path from 'path';
|
|
|
|
const { NODE_ENV } = process.env;
|
|
const production = NODE_ENV === 'production';
|
|
|
|
const plugins = [
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
new webpack.DefinePlugin({
|
|
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
|
|
}),
|
|
];
|
|
|
|
if (production) {
|
|
plugins.push(
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compressor: {
|
|
pure_getters: true,
|
|
unsafe: true,
|
|
unsafe_comps: true,
|
|
screw_ie8: true,
|
|
warnings: false,
|
|
},
|
|
}),
|
|
);
|
|
}
|
|
|
|
export default {
|
|
entry: [
|
|
'babel-polyfill',
|
|
path.join(__dirname, 'src/index.js'),
|
|
],
|
|
output: {
|
|
path: path.join(__dirname, 'dist'),
|
|
filename: `bundle${production ? '.min' : ''}.js`,
|
|
library: 'GeoSearch',
|
|
libraryTarget: 'umd',
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /\.js$/,
|
|
loaders: ['babel-loader'],
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
plugins,
|
|
};
|