Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- const isProduction = process.env.NODE_ENV === 'production';
- module.exports = {
- target: 'web',
- entry: {
- // vendor: [
- // ],
- main: path.resolve(__dirname, 'src', 'index.jsx'),
- },
- output: {
- path: path.resolve(__dirname, 'dist'),
- filename: '[name].[chunkhash].js',
- publicPath: '/',
- },
- module: {
- rules: [
- {
- test: /\.jsx?$/,
- exclude: /node_modules/,
- use: ['babel-loader'],
- },
- {
- test: /\.s?[ac]ss$/,
- use: [
- isProduction ? MiniCssExtractPlugin.loader : 'style-loader',
- 'css-loader',
- 'postcss-loader',
- 'sass-loader',
- ],
- },
- {
- test: /\.(png|svg|jpg|gif)$/,
- use: ['file-loader'],
- },
- {
- test: /\.(woff|woff2|eot|ttf|otf)$/,
- use: ['file-loader'],
- },
- ],
- },
- plugins: [
- new HtmlWebpackPlugin({
- inject: false,
- template: path.join('src', 'index.html'),
- title: 'title',
- }),
- new MiniCssExtractPlugin({}),
- ],
- resolve: {
- extensions: ['.js', '.jsx', '.css', '.scss'],
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement