Skip to content

Commit

Permalink
[Cashtab] Update webpack to support cjs
Browse files Browse the repository at this point in the history
Summary:
Known issue with create-react-app. As more dependencies use these files, will need this support.

Main issue now is that the latest chronik-client won't work, since it uses the latest version of axios, which uses cjs files.

Cashtab will work with the latest version of chronik-client with this webpack config.

I can wait and add them together so there is a test plan, but imo it makes sense to keep this as an isolated change.

This is more or less a backport of (still unmerged) facebook/create-react-app#12021

Cashtab was initially a create-react-app app, but has been ejected and customized to support crypto dependencies.

Test Plan: `npm test`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15077
  • Loading branch information
BytesOfMan committed Jan 4, 2024
1 parent 3a33b4b commit a712112
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cashtab/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ module.exports = function (webpackEnv) {
shouldUseSourceMap && {
enforce: 'pre',
exclude: /@babel(?:\/|\\{1,2})runtime/,
test: /\.(js|mjs|jsx|ts|tsx|css)$/,
test: /\.(js|mjs|cjs|jsx|ts|tsx|css)$/,
loader: require.resolve('source-map-loader'),
},
{
Expand Down Expand Up @@ -415,7 +415,7 @@ module.exports = function (webpackEnv) {
// Process application JS with Babel.
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
test: /\.(js|mjs|cjs|jsx|ts|tsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
Expand Down Expand Up @@ -452,7 +452,7 @@ module.exports = function (webpackEnv) {
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
{
test: /\.(js|mjs)$/,
test: /\.(js|mjs|cjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'),
options: {
Expand Down Expand Up @@ -572,7 +572,7 @@ module.exports = function (webpackEnv) {
// by webpacks internal loaders.
exclude: [
/^$/,
/\.(js|mjs|jsx|ts|tsx)$/,
/\.(js|mjs|cjs|jsx|ts|tsx)$/,
/\.html$/,
/\.json$/,
],
Expand Down Expand Up @@ -758,7 +758,7 @@ module.exports = function (webpackEnv) {
!disableESLintPlugin &&
new ESLintPlugin({
// Plugin options
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'],
extensions: ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx'],
formatter: require.resolve(
'react-dev-utils/eslintFormatter',
),
Expand Down

0 comments on commit a712112

Please sign in to comment.