Created
July 2, 2017 11:04
-
-
Save OmgImAlexis/f74b66c7b7eafafc0f25035cdf77107d to your computer and use it in GitHub Desktop.
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
/* eslint-disable camelcase */ | |
const path = require('path'); | |
const webpack = require('webpack'); | |
// Ref: https://hackernoon.com/optimising-your-application-bundle-size-with-webpack-e85b00bab579 | |
module.exports = { | |
devtool: 'cheap-module-source-map', | |
resolve: { | |
extensions: ['.js', '.vue', '.json'], | |
alias: { | |
vue$: 'vue/dist/vue.esm.js', | |
'@': path.resolve(__dirname, './src') | |
} | |
}, | |
module: { | |
rules: [{ | |
test: /\.js$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/, | |
include: [ | |
path.resolve(__dirname, './src') | |
] | |
}, { | |
test: /\.vue$/, | |
loader: 'vue-loader', | |
options: { | |
loaders: { | |
js: 'babel-loader' | |
} | |
} | |
}] | |
}, | |
entry: [ | |
'./src/main' | |
], | |
output: { | |
filename: 'build.js', | |
path: path.resolve(__dirname, './dist/'), | |
publicPath: 'dist/' | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), // Enable HMR | |
new webpack.EnvironmentPlugin({ | |
NODE_ENV: 'development', | |
BASE_URL: 'https://api.twistly.xyz' | |
}), | |
new webpack.optimize.UglifyJsPlugin({ | |
mangle: true, | |
compress: { | |
warnings: false, // Suppress uglification warnings | |
pure_getters: true, | |
unsafe: true, | |
unsafe_comps: true, | |
screw_ie8: true | |
}, | |
output: { | |
comments: false | |
}, | |
exclude: [/\.min\.js$/gi] // Skip pre-minified libs | |
}), | |
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment