Skip to content

Instantly share code, notes, and snippets.

@mattn9x
Created September 10, 2017 16:00
Show Gist options
  • Save mattn9x/afed36e08ed44dfff049235c7dc59ee0 to your computer and use it in GitHub Desktop.
Save mattn9x/afed36e08ed44dfff049235c7dc59ee0 to your computer and use it in GitHub Desktop.
let webpack = require('webpack');
// import module cùng các plugin phục vụ cho webpack và webpack-dev-server
module.exports = {
/*entry: nới nạp các file cần xử lý, hay còn gọi là nơi tình yêu bắt đầu*/
entry: {
app: './client/sources/app.js'
},
/*output: Nơi tình yêu kết thúc, các file được xuất ra*/
output: {
path: path.join(__dirname, '/client/public'),
filename: "[name].min.js"
},
/*Nạp các plugin từ bên thứ 3 vào xử lý*/
plugins: [
/*nén file javascript*/
new webpack.optimize.UglifyJsPlugin({
minimize: true,
output: {
comments: true
},
compressor: {
warnings: false
}
})
//, nạp thêm các xử lý nén file ở đây
],
module: {
/*Chỉ thị tiền xử lý trước khi chạy loaders*/
preLoaders: [
{}
],
loaders: [
/*Danh sách các loader*/
{},
{}
]
},
/*Chỉ thị phiên bản phuc vụ cho check cú pháp javascript với JSHint hay ESLint*/
jshint: {
esversion: 6
},
/*theo dõi file thay đổi và bundle lại, true: theo dõi, false: ko theo dõi*/
watch: true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment