Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 496 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 496 Rev 929
Línea 1... Línea 1...
1
const path = require("path");
1
const path = require('path')
2
const isDevelopment = process.env.NODE_ENV === "development";
2
const isDevelopment = process.env.NODE_ENV === 'development'
3
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
4
const TerserPlugin = require("terser-webpack-plugin");
4
const TerserPlugin = require('terser-webpack-plugin')
5
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
5
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
Línea 6... Línea 6...
6
 
6
 
7
// change active path here
7
// change active path here
8
const currentPath = {
8
const currentPath = {
9
  entry: "./app/index.js",
9
  entry: './app/index.js',
10
  output: path.join(__dirname, "public/bundles"),
10
  output: path.join(__dirname, 'public/bundles'),
11
  filename: "applicationBundle.js",
11
  filename: 'applicationBundle.js'
Línea 12... Línea 12...
12
};
12
}
13
 
13
 
14
module.exports = {
14
module.exports = {
15
  entry: currentPath.entry,
15
  entry: currentPath.entry,
16
  output: {
16
  output: {
17
    path: currentPath.output,
17
    path: currentPath.output,
18
    filename: currentPath.filename,
18
    filename: currentPath.filename
19
  },
19
  },
20
  watch: false,
20
  watch: false,
21
  mode: "production",
21
  mode: 'production',
22
  resolve: {
22
  resolve: {
23
    extensions: [".js", ".jsx", ".scss"],
23
    extensions: ['.js', '.jsx', '.scss'],
24
    alias: {
24
    alias: {
25
      hooks: path.resolve(__dirname, 'app/hooks/'),
25
      hooks: path.resolve(__dirname, 'app/hooks/'),
-
 
26
      store: path.resolve(__dirname, 'app/redux/'),
26
      store: path.resolve(__dirname, 'app/redux/'),
27
      components: path.resolve(__dirname, 'app/components/'),
27
      components: path.resolve(__dirname, 'app/components/')
28
      '@buttons': path.resolve(__dirname, 'app/components/UI/buttons')
28
    }
29
    }
29
  },
30
  },
30
  module: {
31
  module: {
31
    rules: [
32
    rules: [
32
      {
33
      {
33
        test: /(js|jsx)$/,
34
        test: /(js|jsx)$/,
34
        use: ["babel-loader"],
35
        use: ['babel-loader'],
35
        exclude: /node_modules/,
36
        exclude: /node_modules/
36
      },
37
      },
37
      {
38
      {
38
        test: /\.css$/i,
39
        test: /\.css$/i,
39
        use: [MiniCssExtractPlugin.loader, "css-loader"],
40
        use: [MiniCssExtractPlugin.loader, 'css-loader']
40
      },
41
      },
41
      {
42
      {
42
        test: /\.module\.s(a|c)ss$/,
43
        test: /\.module\.s(a|c)ss$/,
43
        use: [
44
        use: [
44
          MiniCssExtractPlugin.loader,
45
          MiniCssExtractPlugin.loader,
45
          {
46
          {
46
            loader: "css-loader",
47
            loader: 'css-loader',
47
            options: {
48
            options: {
48
              modules: {
49
              modules: {
49
                localIdentName: "[local]--[hash:base64:5]",
50
                localIdentName: '[local]--[hash:base64:5]'
50
              },
51
              },
51
              sourceMap: isDevelopment,
52
              sourceMap: isDevelopment
52
            },
53
            }
53
          },
54
          },
54
          {
55
          {
55
            loader: "sass-loader",
56
            loader: 'sass-loader',
56
            options: {
57
            options: {
57
              sourceMap: isDevelopment,
58
              sourceMap: isDevelopment
58
            },
59
            }
59
          },
60
          }
60
        ],
61
        ]
61
      },
62
      },
62
      {
63
      {
63
        test: /\.s(a|c)ss$/,
64
        test: /\.s(a|c)ss$/,
64
        exclude: /\.module.(s(a|c)ss)$/,
65
        exclude: /\.module.(s(a|c)ss)$/,
65
        use: [
66
        use: [
66
          MiniCssExtractPlugin.loader,
67
          MiniCssExtractPlugin.loader,
67
          "css-loader",
68
          'css-loader',
68
          {
69
          {
69
            loader: "sass-loader",
70
            loader: 'sass-loader',
70
            options: {
71
            options: {
71
              sourceMap: isDevelopment,
72
              sourceMap: isDevelopment
72
            },
73
            }
73
          },
74
          }
74
        ],
75
        ]
75
      },
76
      }
76
    ],
77
    ]
77
  },
78
  },
78
  plugins: [
79
  plugins: [
79
    new MiniCssExtractPlugin({
80
    new MiniCssExtractPlugin({
80
      filename: "[name].css",
81
      filename: '[name].css',
81
      chunkFilename: "[id].css",
82
      chunkFilename: '[id].css'
82
    }),
83
    })
83
  ],
84
  ],
84
  optimization: {
85
  optimization: {
85
    minimizer: [
86
    minimizer: [
86
      new TerserPlugin({
87
      new TerserPlugin({
87
        extractComments: false,
88
        extractComments: false
88
      }),
89
      })
89
    ],
90
    ]