Skip to content

Instantly share code, notes, and snippets.

@rustam87
Created January 16, 2018 13:51
Show Gist options
  • Save rustam87/c2c41fddd7a9f9ed0b2acfd6c0b142bb to your computer and use it in GitHub Desktop.
Save rustam87/c2c41fddd7a9f9ed0b2acfd6c0b142bb to your computer and use it in GitHub Desktop.
webpack config
module.exports = {
name: 'js',
context: path.resolve(__dirname, sourcePath),
entry: {
common: './common/common.js',
"form-filter": './form-filter/index.js',
"map": './map/index.js',
'discount-settlers': '../../assets/discountSettlers/discount-settlers.js',
'partners': '../../assets/partners/partners-slider.js',
},
output: {
path: path.resolve(__dirname, distPath),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.js$/,
enforce: "pre",
exclude: /node_modules/,
loader: "eslint-loader",
options: {
fix: true,
quiet: true
}
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
}
]
},
plugins: [
new SvgStore({
svgoOptions: {
plugins: [
{
removeTitle: true
}
]
},
prefix: 'svg-icon-'
}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
'$': 'jquery',
helpers: path.resolve(__dirname, sourcePath + '/helpers.js'),
Promise: 'imports-loader?this=>global!exports-loader?global.Promise!es6-promise',
fetch: 'imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch'
}),
//new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
//}),
new webpack.optimize.CommonsChunkPlugin({
name: "common",
filename: "common.js"
})
],
devtool: 'source-map',
watch: true
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment