Skip to content

Commit

Permalink
fix(ci): disable graph3d for netlify builds (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
happylolonly authored Oct 9, 2024
1 parent 73c1050 commit 5ed06e8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
23 changes: 23 additions & 0 deletions netlify/mocks/Graph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';

console.log(React.version);

export function GraphMock() {
return (
<div
style={{
position: 'absolute',
zIndex: 10,
color: 'white',
top: '50%',
}}
>
graph is disabled for netlify builds
</div>
);
}

const Graph = GraphMock;

// eslint-disable-next-line import/no-unused-modules
export default Graph;
9 changes: 9 additions & 0 deletions netlify/mocks/ReactForceGraph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { GraphMock } from './Graph';

console.log(React.version);

// eslint-disable-next-line import/no-unused-modules, import/prefer-default-export
export function ForceGraph3D() {
return <GraphMock />;
}
3 changes: 1 addition & 2 deletions webpack.config.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ const config = {
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
include: /src/,
// include: [/src/, /node_modules\/typeit-react/],
include: [/src/, /netlify\/mocks/],
use: {
loader: 'esbuild-loader',
options: {
Expand Down
14 changes: 14 additions & 0 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const TerserPlugin = require('terser-webpack-plugin');
// const CompressionWebpackPlugin = require('compression-webpack-plugin');
const WorkboxPlugin = require('workbox-webpack-plugin');
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const webpack = require('webpack');
const commonConfig = require('./webpack.config.common');

module.exports = merge(commonConfig, {
Expand Down Expand Up @@ -44,6 +45,19 @@ module.exports = merge(commonConfig, {
],
},
plugins: [
...(process.env.NETLIFY
? [
new webpack.NormalModuleReplacementPlugin(
/react-force-graph/,
(resource) => {
resource.request = 'src/../netlify/mocks/ReactForceGraph';
}
),
// new webpack.NormalModuleReplacementPlugin(/\/GraphNew/, (resource) => {
// resource.request = 'src/../netlify/mocks/Graph';
// }),
]
: []),
// disabled to speed up builds
// new BundleAnalyzerPlugin({
// analyzerMode: 'static',
Expand Down

0 comments on commit 5ed06e8

Please sign in to comment.