From 6ffa07fee3b8a46dc2e4a86172e90e1f9fade980 Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Tue, 13 Jul 2021 17:23:13 +0200 Subject: [PATCH] try to ignore some modules during SSR in docz --- platform/ui/gatsby-node.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/platform/ui/gatsby-node.js b/platform/ui/gatsby-node.js index 0efa56fe8..5238c944c 100644 --- a/platform/ui/gatsby-node.js +++ b/platform/ui/gatsby-node.js @@ -2,8 +2,25 @@ const path = require('path'); // ~~ Plugins const PnpWebpackPlugin = require(`pnp-webpack-plugin`); // Required until Webpack@5 -exports.onCreateWebpackConfig = args => { - args.actions.setWebpackConfig({ +exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => { + if (stage === 'build-html' || stage === 'develop-html') { + actions.setWebpackConfig({ + module: { + rules: [ + { + test: /\@ohif\/core/, + use: loaders.null(), + }, + { + test: /cornerstone\-math/, + use: loaders.null(), + }, + ], + }, + }); + } + + actions.setWebpackConfig({ node: { fs: 'empty' }, resolve: { plugins: [PnpWebpackPlugin], @@ -14,9 +31,6 @@ exports.onCreateWebpackConfig = args => { // .docz 'node_modules', ], - // resolve: { - // symlinks: true, - // }, }, resolveLoader: { plugins: [PnpWebpackPlugin.moduleLoader(module)],