Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: add patch to support cjs modules

Abdullah Attaae8c22011984
diff --git a/apps/web/patches/react-scripts+5.0.1.patch b/apps/web/patches/react-scripts+5.0.1.patch
index 0e49af571..c18ad09cc 100644
--- a/apps/web/patches/react-scripts+5.0.1.patch
+++ b/apps/web/patches/react-scripts+5.0.1.patch
@@ -1,5 +1,5 @@
diff --git a/node_modules/react-scripts/config/webpack.config.js b/node_modules/react-scripts/config/webpack.config.js
-index e465d8e..769f0dd 100644
+index e465d8e..0fbcf67 100644
--- a/node_modules/react-scripts/config/webpack.config.js
+++ b/node_modules/react-scripts/config/webpack.config.js
@@ -106,6 +106,9 @@ module.exports = function (webpackEnv) {
@@ -75,3 +75,46 @@ index e465d8e..769f0dd 100644
],
},
module: {
+@@ -353,7 +365,7 @@ module.exports = function (webpackEnv) {
+ shouldUseSourceMap && {
+ enforce: 'pre',
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
+- test: /\.(js|mjs|jsx|ts|tsx|css)$/,
++ test: /\.(cjs|js|mjs|jsx|ts|tsx|css)$/,
+ loader: require.resolve('source-map-loader'),
+ },
+ {
+@@ -408,13 +420,13 @@ module.exports = function (webpackEnv) {
+ },
+ ],
+ issuer: {
+- and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
++ and: [/\.(ts|tsx|cjs|js|jsx|md|mdx)$/],
+ },
+ },
+ // Process application JS with Babel.
+ // The preset includes JSX, Flow, TypeScript, and some ESnext features.
+ {
+- test: /\.(js|mjs|jsx|ts|tsx)$/,
++ test: /\.(cjs|js|mjs|jsx|ts|tsx)$/,
+ include: paths.appSrc,
+ loader: require.resolve('babel-loader'),
+ options: {
+@@ -466,7 +478,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: /\.(cjs|js|mjs)$/,
+ exclude: /@babel(?:\/|\\{1,2})runtime/,
+ loader: require.resolve('babel-loader'),
+ options: {
+@@ -594,7 +606,7 @@ module.exports = function (webpackEnv) {
+ // its runtime that would otherwise be processed through "file" loader.
+ // Also exclude `html` and `json` extensions so they get processed
+ // by webpacks internal loaders.
+- exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
++ exclude: [/^$/, /\.(cjs|js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
+ type: 'asset/resource',
+ },
+ // ** STOP ** Are you adding a new loader?