Created
May 28, 2020 09:27
-
-
Save navsqi/cab19c6901eba0043ecc648fdd71fe70 to your computer and use it in GitHub Desktop.
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 path = require('path'); | |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| module.exports = { | |
| // Entry | |
| entry: './src/index.js', | |
| // Output | |
| output: { | |
| path: path.resolve(__dirname, 'dist'), | |
| filename: 'bundle.js', | |
| }, | |
| // Mode | |
| mode: 'production', | |
| // Loader | |
| module: { | |
| rules: [ | |
| { | |
| // CSS Loader | |
| test: /\.css$/, | |
| use: [ | |
| { | |
| loader: 'style-loader', | |
| }, | |
| { | |
| loader: 'css-loader', | |
| }, | |
| ], | |
| }, | |
| { | |
| // BABEL Loader | |
| test: /\.js$/, | |
| exclude: '/node_modules/', | |
| use: [ | |
| { | |
| loader: 'babel-loader', | |
| options: { | |
| presets: ['@babel/preset-env'], | |
| }, | |
| }, | |
| ], | |
| }, | |
| ], | |
| }, | |
| // Plugin | |
| plugins: [ | |
| // Plugin: HTML Webpack | |
| new HtmlWebpackPlugin({ | |
| template: './src/template.html', | |
| filename: 'index.html', | |
| }), | |
| ], | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment