Developed a Shopify Remix app prior to template migration to Vite. There is a library @shopify/polaris-viz that I am using for graphics. However, it was constantly throwing the ERR_REQUIRE_ESM string-width error when trying to run the project. It was later fixed using serverDependenciesToBundle as suggested here . However, I'm now having trouble migrating this to the Vite implementation. Since remix.config.ts no longer exists what should be the best way to handle the following error?
require() of ES Module /app/node_modules/d3-scale/src/index.js from /app/node_modules/@shopify/polaris-viz-core/build/cjs/utilities/createGradient.js not supported.
Instead change the require of index.js in /app/node_modules/@shopify/polaris-viz-core/build/cjs/utilities/createGradient.js to a dynamic import() which is available in all CommonJS modules.
Looking at threads 7872 and 7865 in the official remix repository doesn't seem to be working. As suggested in 7865, I put the wrong package, in this case d3-scale in ssr -> noExternal but this doesn't seem to be working.
ssr: {
noExternal: ["d3-scale"]
}
Steps to reproduce the issue:
Set up a new project
Add @shopify/polaris-viz to the project
import { PolarisVizProvider } from "@shopify/polaris-viz";
Any help with this is greatly appreciated.