-
-
Save risha700/e5f3c04a085f2ea017d81cb507d64f0f to your computer and use it in GitHub Desktop.
webpack.config.js file from https://laracasts.com/series/learn-vue-2-step-by-step/episodes/22
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
let webpack = require('webpack'); | |
let path = require('path'); | |
module.exports = { | |
entry: { | |
app: './resources/assets/js/app.js', | |
vendor: ['vue', 'axios'] | |
}, | |
output: { | |
path: path.resolve(__dirname, 'public/js'), | |
filename: '[name].js', | |
publicPath: '/' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader' | |
} | |
] | |
}, | |
resolve: { | |
alias: { | |
'vue$': 'vue/dist/vue.common.js' | |
} | |
}, | |
plugins: [ | |
new webpack.optimize.CommonsChunkPlugin({ | |
names: ['vendor'] | |
}) | |
] | |
}; | |
if (process.env.NODE_ENV === 'production') { | |
module.exports.plugins.push( | |
new webpack.optimize.UglifyJsPlugin({ | |
sourcemap: true, | |
compress: { | |
warnings: false | |
} | |
}) | |
); | |
module.exports.plugins.push( | |
new webpack.DefinePlugin({ | |
'process.env': { | |
NODE_ENV: '"production"' | |
} | |
}) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment