Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2865 Rev 3416
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.jsx',
9
  entry: "./app/index.jsx",
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
    alias: {
23
    alias: {
24
      ckeditor5: path.resolve(
24
      ckeditor5: path.resolve(
25
        __dirname,
25
        __dirname,
26
        'node_modules/ckeditor5/dist/ckeditor5.js'
26
        "node_modules/ckeditor5/dist/ckeditor5.js"
27
      ),
27
      ),
28
      'ckeditor5.css': path.resolve(
28
      "ckeditor5.css": path.resolve(
29
        __dirname,
29
        __dirname,
30
        'node_modules/ckeditor5/dist/ckeditor5.css'
30
        "node_modules/ckeditor5/dist/ckeditor5.css"
31
      ),
31
      ),
32
      '@components': path.resolve(__dirname, 'app/components/'),
32
      "@components": path.resolve(__dirname, "app/components/"),
33
      '@constants': path.resolve(__dirname, 'app/constants/'),
33
      "@constants": path.resolve(__dirname, "app/constants/"),
-
 
34
      "@hocs": path.resolve(__dirname, "app/hocs/index.js"),
34
      '@hocs': path.resolve(__dirname, 'app/hocs/index.js'),
35
      "@hooks": path.resolve(__dirname, "app/hooks/index.js"),
35
      '@hooks': path.resolve(__dirname, 'app/hooks/index.js'),
36
      "@api": path.resolve(__dirname, "app/libs/axios.js"),
36
      '@layouts': path.resolve(__dirname, 'app/layouts/'),
37
      "@layouts": path.resolve(__dirname, "app/layouts/"),
37
      '@pages': path.resolve(__dirname, 'app/pages/'),
38
      "@pages": path.resolve(__dirname, "app/pages/"),
38
      '@providers': path.resolve(__dirname, 'app/providers/'),
39
      "@providers": path.resolve(__dirname, "app/providers/"),
39
      '@store': path.resolve(__dirname, 'app/redux/'),
40
      "@store": path.resolve(__dirname, "app/redux/"),
40
      '@styles': path.resolve(__dirname, 'app/styles/'),
41
      "@styles": path.resolve(__dirname, "app/styles/"),
41
      '@services': path.resolve(__dirname, 'app/services/'),
42
      "@services": path.resolve(__dirname, "app/services/"),
42
      '@utils': path.resolve(__dirname, 'app/utils/'),
43
      "@utils": path.resolve(__dirname, "app/utils/"),
43
      '@app': path.resolve(__dirname, 'app/'),
44
      "@app": path.resolve(__dirname, "app/"),
44
      store: path.resolve(__dirname, 'app/redux/'),
45
      store: path.resolve(__dirname, "app/redux/"),
45
      components: path.resolve(__dirname, 'app/components/'),
46
      components: path.resolve(__dirname, "app/components/"),
46
      utils: path.resolve(__dirname, 'app/utils/')
47
      utils: path.resolve(__dirname, "app/utils/"),
47
    },
48
    },
48
    extensions: ['.js', '.jsx', '.scss', '.css']
49
    extensions: [".js", ".jsx", ".scss", ".css"],
49
  },
50
  },
50
  module: {
51
  module: {
51
    rules: [
52
    rules: [
52
      {
53
      {
53
        test: /(js|jsx)$/,
54
        test: /(js|jsx)$/,
54
        use: ['babel-loader'],
55
        use: ["babel-loader"],
55
        exclude: /node_modules/
56
        exclude: /node_modules/,
56
      },
57
      },
57
      {
58
      {
58
        test: /\.css$/i,
59
        test: /\.css$/i,
59
        use: [MiniCssExtractPlugin.loader, 'css-loader']
60
        use: [MiniCssExtractPlugin.loader, "css-loader"],
60
      },
61
      },
61
      {
62
      {
62
        test: /\.module\.s(a|c)ss$/,
63
        test: /\.module\.s(a|c)ss$/,
63
        use: [
64
        use: [
64
          MiniCssExtractPlugin.loader,
65
          MiniCssExtractPlugin.loader,
65
          {
66
          {
66
            loader: 'css-loader',
67
            loader: "css-loader",
67
            options: {
68
            options: {
68
              modules: {
69
              modules: {
69
                localIdentName: '[local]--[hash:base64:5]'
70
                localIdentName: "[local]--[hash:base64:5]",
70
              },
71
              },
71
              sourceMap: isDevelopment
72
              sourceMap: isDevelopment,
72
            }
73
            },
73
          },
74
          },
74
          {
75
          {
75
            loader: 'sass-loader',
76
            loader: "sass-loader",
76
            options: {
77
            options: {
77
              sourceMap: isDevelopment
78
              sourceMap: isDevelopment,
78
            }
79
            },
79
          }
80
          },
80
        ]
81
        ],
81
      },
82
      },
82
      {
83
      {
83
        test: /\.s(a|c)ss$/,
84
        test: /\.s(a|c)ss$/,
84
        exclude: /\.module.(s(a|c)ss)$/,
85
        exclude: /\.module.(s(a|c)ss)$/,
85
        use: [
86
        use: [
86
          MiniCssExtractPlugin.loader,
87
          MiniCssExtractPlugin.loader,
87
          'css-loader',
88
          "css-loader",
88
          {
89
          {
89
            loader: 'sass-loader',
90
            loader: "sass-loader",
90
            options: {
91
            options: {
91
              sourceMap: isDevelopment
92
              sourceMap: isDevelopment,
92
            }
93
            },
93
          }
94
          },
94
        ]
95
        ],
95
      }
96
      },
96
    ]
97
    ],
97
  },
98
  },
98
  plugins: [
99
  plugins: [
99
    new MiniCssExtractPlugin({
100
    new MiniCssExtractPlugin({
100
      filename: '[name].css',
101
      filename: "[name].css",
101
      chunkFilename: '[id].css'
102
      chunkFilename: "[id].css",
102
    })
103
    }),
103
  ],
104
  ],
104
  optimization: {
105
  optimization: {
105
    minimizer: [
106
    minimizer: [
106
      new TerserPlugin({
107
      new TerserPlugin({
107
        extractComments: false
108
        extractComments: false,
108
      })
109
      }),
109
    ]
110
    ],