Skip to content

Instantly share code, notes, and snippets.

@zprima
Created June 9, 2019 07:14
Show Gist options
  • Save zprima/53ed8d58c7de09fc6a584e4d12cc0b9d to your computer and use it in GitHub Desktop.
Save zprima/53ed8d58c7de09fc6a584e4d12cc0b9d to your computer and use it in GitHub Desktop.
medium_p9_c3
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = {
entry: './src/index.js', // default
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader', // compiles Sass to CSS, using Node Sass by default
],
},
]
},
resolve: {
extensions: ['*', '.js', '.jsx']
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.html'
}),
new webpack.HotModuleReplacementPlugin(),
new CopyPlugin([
{ from: 'src', to: 'dist' }
]),
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 3000,
hot: true
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment