diff --git a/build-utils/addons/webpack.bundleanalyzer.js b/build-utils/addons/webpack.bundleanalyzer.js deleted file mode 100644 index 69b251e..0000000 --- a/build-utils/addons/webpack.bundleanalyzer.js +++ /dev/null @@ -1,9 +0,0 @@ -const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; - -module.exports = { - plugins: [ - new BundleAnalyzerPlugin({ - analyzerMode: "server", - }), - ], -}; diff --git a/build-utils/build-validations.js b/build-utils/build-validations.js deleted file mode 100644 index a06cff9..0000000 --- a/build-utils/build-validations.js +++ /dev/null @@ -1,6 +0,0 @@ -const chalk = require("chalk"); -const ERR_NO_ENV_FLAG = chalk.red(`You must pass an --env.env flag into your build for webpack to work!`); - -module.exports = { - ERR_NO_ENV_FLAG, -}; diff --git a/build-utils/common-paths.js b/build-utils/common-paths.js deleted file mode 100644 index 98aa593..0000000 --- a/build-utils/common-paths.js +++ /dev/null @@ -1,8 +0,0 @@ -const path = require("path"); -const PROJECT_ROOT = path.resolve(__dirname, "../"); - -module.exports = { - projectRoot: PROJECT_ROOT, - outputPath: path.join(PROJECT_ROOT, "dist"), - appEntry: path.join(PROJECT_ROOT, "src"), -}; diff --git a/build-utils/webpack.common.js b/build-utils/webpack.common.js deleted file mode 100644 index 22bb836..0000000 --- a/build-utils/webpack.common.js +++ /dev/null @@ -1,49 +0,0 @@ -const commonPaths = require("./common-paths"); - -const webpack = require("webpack"); -const HtmlWebpackPlugin = require("html-webpack-plugin"); - -const config = { - entry: { - vendor: ["semantic-ui-react"], - }, - output: { - path: commonPaths.outputPath, - publicPath: "/", - }, - module: { - rules: [ - { - test: /\.(js)$/, - exclude: /node_modules/, - use: ["babel-loader"], - }, - ], - }, - optimization: { - splitChunks: { - cacheGroups: { - styles: { - name: "styles", - test: /\.css$/, - chunks: "all", - enforce: true, - }, - vendor: { - chunks: "initial", - test: "vendor", - name: "vendor", - enforce: true, - }, - }, - }, - }, - plugins: [ - new HtmlWebpackPlugin({ - template: `public/index.html`, - favicon: `public/favicon.ico`, - }), - ], -}; - -module.exports = config; diff --git a/build-utils/webpack.dev.js b/build-utils/webpack.dev.js deleted file mode 100644 index c54560c..0000000 --- a/build-utils/webpack.dev.js +++ /dev/null @@ -1,60 +0,0 @@ -const commonPaths = require("./common-paths"); - -const webpack = require("webpack"); - -const port = process.env.PORT || 3000; - -const config = { - mode: "development", - entry: { - app: `${commonPaths.appEntry}/index.js`, - }, - output: { - filename: "[name].[hash].js", - }, - resolve: { - alias: {}, - }, - devtool: "inline-source-map", - module: { - rules: [ - { - test: /\.css$/, - use: [ - { - loader: "style-loader", - }, - { - loader: "css-loader", - options: { - modules: true, - localsConvention: "camelCase", - sourceMap: true, - }, - }, - ], - }, - ], - }, - plugins: [new webpack.HotModuleReplacementPlugin()], - devServer: { - host: "localhost", - port: port, - historyApiFallback: true, - hot: true, - open: true, - proxy: { - "/rest": { - target: "http://localhost:18115/og_spipes", - ws: true, - }, - "/notifications": { - target: "ws://localhost:18115/og_spipes/rest", - changeOrigin: true, - ws: true, - }, - }, - }, -}; - -module.exports = config; diff --git a/build-utils/webpack.prod.js b/build-utils/webpack.prod.js deleted file mode 100644 index d1a052a..0000000 --- a/build-utils/webpack.prod.js +++ /dev/null @@ -1,46 +0,0 @@ -const commonPaths = require("./common-paths"); - -const webpack = require("webpack"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); - -const config = { - mode: "production", - entry: { - app: [`${commonPaths.appEntry}/index.js`], - }, - output: { - filename: "static/[name].[hash].js", - }, - devtool: "source-map", - module: { - rules: [ - { - test: /\.css$/, - use: [ - { - loader: MiniCssExtractPlugin.loader, - }, - { - loader: "css-loader", - options: { - modules: true, - importLoaders: 1, - localsConvention: "camelCase", - sourceMap: true, - }, - }, - { - loader: "postcss-loader", - }, - ], - }, - ], - }, - plugins: [ - new MiniCssExtractPlugin({ - filename: "styles/[name].[hash].css", - }), - ], -}; - -module.exports = config; diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 69c30c0..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,11 +0,0 @@ -import postcssPresetEnv from "postcss-preset-env"; -import cssnano from "cssnano"; - -export default { - plugins: [ - postcssPresetEnv({ - browsers: [">0.25%", "not ie 11", "not op_mini all"], - }), - cssnano(), - ], -}; diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 53a5813..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,29 +0,0 @@ -const buildValidations = require("./build-utils/build-validations"); -const commonConfig = require("./build-utils/webpack.common"); - -const webpackMerge = require("webpack-merge"); - -const addons = (/* string | string[] */ addonsArg) => { - let addons = [...[addonsArg]] // Normalize array of addons (flatten) - .filter(Boolean); // If addons is undefined, filter it out - - return addons.map((addonName) => require(`./build-utils/addons/webpack.${addonName}.js`)); -}; - -module.exports = (env) => { - if (!env) { - throw new Error(buildValidations.ERR_NO_ENV_FLAG); - } - - const envConfig = require(`./build-utils/webpack.${env.env}.js`); - - const resolveConfig = { - resolve: { - fallback: { - util: false, - }, - }, - }; - - return webpackMerge(commonConfig, envConfig, resolveConfig, ...addons(env.addons)); -};