Created
June 9, 2019 07:14
-
-
Save zprima/53ed8d58c7de09fc6a584e4d12cc0b9d to your computer and use it in GitHub Desktop.
medium_p9_c3
This file contains hidden or 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
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