Created
November 9, 2021 15:46
-
-
Save kjkasi/6a9b90d479e592b03b6643544ca3dba0 to your computer and use it in GitHub Desktop.
webpack.config.js
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'); | |
| const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | |
| module.exports = { | |
| mode: 'development', | |
| entry: './src/index.js', | |
| devtool: 'inline-source-map', | |
| devServer: { | |
| contentBase: './dist', | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.m?js$/, | |
| exclude: /(node_modules|bower_components)/, | |
| use: { | |
| loader: 'babel-loader', | |
| options: { | |
| presets: [[ | |
| '@babel/preset-env', | |
| { | |
| 'corejs': 3, | |
| 'useBuiltIns': 'usage', | |
| 'debug': true, | |
| 'targets': [ | |
| 'last 2 versions' | |
| ] | |
| }], | |
| '@babel/preset-react' | |
| ], | |
| plugins: [ | |
| '@babel/plugin-proposal-class-properties' | |
| ] | |
| } | |
| } | |
| }, | |
| { | |
| test: /\.css$/, | |
| use: [ | |
| 'style-loader', | |
| 'css-loader' | |
| ] | |
| } | |
| ] | |
| }, | |
| plugins: [ | |
| new CleanWebpackPlugin(), | |
| new HtmlWebpackPlugin({ | |
| title: 'Development', | |
| template: 'src/index.html' | |
| }), | |
| ], | |
| output: { | |
| filename: '[name].bundle.js', | |
| path: path.resolve(__dirname, 'dist'), | |
| publicPath: '/react', | |
| }, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment