1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- var path = require('path')
- var webpack = require('webpack')
- module.exports = {
- entry: './lofig.js',
- output: {
- path: path.resolve(__dirname, './dist'),
- publicPath: '/dist',
- filename: 'lofig.min.js',
- },
- resolve: {
- alias: {
- modules: path.join(__dirname, 'node_modules')
- }
- },
- resolveLoader: {
- root: path.join(__dirname, 'node_modules'),
- },
- module: {
- loaders: [
- {
- test: /\.js$/,
- loader: 'babel',
- exclude: /node_modules/,
- query: {
- presets: ['es2015']
- }
- }
- ]
- },
- devServer: {
- historyApiFallback: true,
- noInfo: true
- },
- devtool: '#eval-source-map',
- plugins: [
- new webpack.ProvidePlugin({
- 'Promise': 'bluebird',
- 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
- }),
- ]
- }
- if (process.env.NODE_ENV === 'production') {
- module.exports.devtool = '#source-map'
- module.exports.plugins = (module.exports.plugins || []).concat([
- new webpack.DefinePlugin({
- 'process.env': {
- NODE_ENV: '"production"'
- }
- }),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false
- }
- }),
- new webpack.optimize.OccurenceOrderPlugin()
- ])
- }
|