Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- const webpack = require('webpack');
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- const Dotenv = require('dotenv-webpack');
- const BrotliGzipPlugin = require('brotli-gzip-webpack-plugin');
- module.exports = {
- mode: 'development',
- entry: './src/index.js',
- output: {
- path: path.resolve('dist'),
- filename: '[name].[contenthash].js',
- chunkFilename: '[name].[contenthash].bundle.js',
- publicPath: '/'
- },
- devtool: 'source-map',
- resolveLoader: {
- moduleExtensions: ['-loader']
- },
- resolve: {
- extensions: ['.js', '.jsx']
- },
- module: {
- rules: [
- {
- test: [/\.jsx$/, /\.js$/],
- exclude: /node_modules/,
- loader: 'babel-loader',
- query: {
- presets: ['es2016', 'react', 'stage-0']
- }
- },
- {
- test: /\.html$/,
- exclude: /node_modules/,
- loader: 'html-loader'
- },
- {
- test: /\.css$/,
- exclude: /node_modules/,
- use: ['style-loader', 'css-loader']
- },
- {
- test: /\.scss$/,
- use: [
- {
- loader: 'style-loader'
- },
- {
- loader: 'css-loader',
- options: {
- sourceMap: true
- }
- },
- {
- loader: 'sass-loader',
- options: {
- sourceMap: true
- }
- }
- ]
- },
- {
- test: /\.s?[ac]ss$/,
- use: [
- MiniCssExtractPlugin.loader,
- { loader: 'css-loader', options: { url: false, sourceMap: true } },
- { loader: 'sass-loader', options: { sourceMap: true } }
- ]
- },
- {
- test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
- use: [
- {
- loader: 'file-loader',
- options: {}
- }
- ]
- }
- ]
- },
- optimization: {
- splitChunks: {
- cacheGroups: {
- commons: {
- test: /[\\/]node_modules[\\/]/,
- name: 'vendor',
- chunks: 'all'
- }
- }
- }
- },
- devServer: {
- historyApiFallback: true,
- port: 5163
- },
- plugins: [
- new HtmlWebpackPlugin({
- template: './public/index.html',
- filename: 'index.html'
- }),
- new MiniCssExtractPlugin({
- filename: 'style.css'
- }),
- new Dotenv({
- path: './.env' // Path to .env file (this is the default)
- }),
- new webpack.DefinePlugin({
- 'process.env.URL_API': JSON.stringify(process.env.URL_API),
- 'process.env.GOOGLE_CLIENT_ID': JSON.stringify(
- process.env.GOOGLE_CLIENT_ID
- )
- })
- // new BrotliGzipPlugin({
- // asset: '[path].br[query]',
- // algorithm: 'brotli',
- // test: /\.(js|css|html|svg)$/,
- // threshold: 10240,
- // minRatio: 0.8,
- // quality: 11
- // }),
- // new BrotliGzipPlugin({
- // asset: '[path].gz[query]',
- // algorithm: 'gzip',
- // test: /\.(js|css|html|svg)$/,
- // threshold: 10240,
- // minRatio: 0.8
- // })
- ]
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement