Skip to content

Instantly share code, notes, and snippets.

@jayjariwala
Last active February 16, 2018 20:08
Show Gist options
  • Select an option

  • Save jayjariwala/8933371f5dab4aa9395d1e9b4b871e33 to your computer and use it in GitHub Desktop.

Select an option

Save jayjariwala/8933371f5dab4aa9395d1e9b4b871e33 to your computer and use it in GitHub Desktop.
Webpack config essential plugins and loaders
//plugins
html-webpack-plugin -load javascript file dynamically
clean-webpack-plugin -clean distribution folder.
//css loaders
style-loader
css-loader
//basic demo file
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: {
App : './src/app.js'
},
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
hot:true
},
plugins: [
new HtmlWebpackPlugin({
title:"development"
}),
new CleanWebpackPlugin(['dist']),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin()
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname,'dist')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment