aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-12-21 14:55:48 -0500
committerbobzel <zzzman@gmail.com>2023-12-21 14:55:48 -0500
commit1caba64ee0f32ee8af79263cd4ef2a8bc5d5146e (patch)
tree0fa0e957d1f342fdc6ed4a4b43f5dddfddb1298a /webpack.config.js
parent02eb7da95df283606d4275a22d9451cef371c3b5 (diff)
parent2691b951d96f2ce7652acbea9e340b61737b3b57 (diff)
Merge branch 'moreUpgrading' into dataViz-annotations
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js60
1 files changed, 37 insertions, 23 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 01625988c..d92086bc2 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,24 +1,25 @@
+/* eslint-disable node/no-unpublished-require */
const path = require('path');
const webpack = require('webpack');
-const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
+const { parsed } = require('dotenv').config();
const plugins = [
- new CopyWebpackPlugin([
- {
- from: 'deploy',
- to: path.join(__dirname, 'build'),
- },
- ]),
new HtmlWebpackPlugin({
title: 'Caching',
}),
- new ForkTsCheckerWebpackPlugin({
- tslint: true,
- // memoryLimit: 4096,
- useTypescriptIncrementalApi: true,
- }),
+ // new ForkTsCheckerWebpackPlugin({
+ // typescript: {
+ // // useTypescriptIncrementalApi: true,
+ // // eslint: true,
+ // memoryLimit: 8192,
+ // },
+ // // tslint: true,
+ // // memoryLimit: 4096,
+ // // useTypescriptIncrementalApi: true,
+ // // tslintAutoFix: true,
+ // }),
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
new webpack.ProvidePlugin({ process: 'process/browser' }),
new webpack.HotModuleReplacementPlugin(),
@@ -26,12 +27,12 @@ const plugins = [
function transferEnvironmentVariables() {
const prefix = '_CLIENT_';
- const { parsed } = require('dotenv').config();
if (!parsed) {
return;
}
const resolvedClientSide = Object.keys(parsed).reduce((mapping, envKey) => {
if (envKey.startsWith(prefix)) {
+ // eslint-disable-next-line
mapping[`process.env.${envKey.replace(prefix, '')}`] = JSON.stringify(parsed[envKey]);
}
return mapping;
@@ -58,7 +59,7 @@ module.exports = {
publicPath: '/',
},
resolve: {
- extensions: ['.js', '.ts', '.tsx'],
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
fallback: {
fs: false,
tls: false,
@@ -68,6 +69,8 @@ module.exports = {
crypto: false,
assert: false,
os: false,
+ querystring: require.resolve('querystring-es3'),
+ url: require.resolve('url'),
path: require.resolve('path-browserify'),
http: require.resolve('http-browserify'),
https: require.resolve('https-browserify'),
@@ -89,6 +92,11 @@ module.exports = {
],
},
{
+ test: /\.jsx$/,
+ use: { loader: 'babel-loader' },
+ exclude: [/node_modules/, /public/],
+ },
+ {
test: /\.m?js/,
resolve: {
fullySpecified: false,
@@ -100,16 +108,22 @@ module.exports = {
},
{
test: /\.scss|css$/,
+ exclude: /\.module\.scss$/i,
use: [
- {
- loader: 'style-loader',
- },
- {
- loader: 'css-loader',
- },
- {
- loader: 'sass-loader',
- },
+ { loader: 'style-loader' }, // eslint-disable-next-line prettier/prettier
+ { loader: 'css-loader' },
+ { loader: 'sass-loader' },
+ ],
+ },
+
+ // --------
+ // SCSS MODULES - all have .module. in their name and can export to .tsx
+ {
+ test: /\.module\.scss$/i,
+ use: [
+ { loader: 'style-loader' }, // eslint-disable-next-line prettier/prettier
+ { loader: 'css-loader', options: { modules: true } },
+ { loader: 'sass-loader' },
],
},
{