Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OmgImAlexis/f74b66c7b7eafafc0f25035cdf77107d to your computer and use it in GitHub Desktop.
Save OmgImAlexis/f74b66c7b7eafafc0f25035cdf77107d to your computer and use it in GitHub Desktop.
/* 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