Replies: 1 comment
-
@askneedle The issue is due to the alias which circumvents Node's ability to perform module resolution automatically. Instead Node will just assume it's CJS and not ESM because there is no To fix the issue:
Additional insights:
const config = {
plugins: [remix(remixConfig)],
resolve: {
alias: {
'~': path.resolve('./app')
},
},
};
if (isProduction) {
// don't attempt to optimize, we'll provide it directly below
config.optimizeDeps = {
exclude: ['@tensorflow/tfjs'],
};
config.resolve.alias['@tensorflow/tfjs'] = path.resolve(
__dirname,
'node_modules/@tensorflow/tfjs/dist/tf.es2017.min.js'
);
// ...
}
return config; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Remix + Vite + MUI: ESM/CommonJS Conflict After Migration
Description
I'm encountering issues with building and starting a project that was recently migrated to Vite from the classic compiler. The project builds successfully, but when attempting to start after a successful build, it encounters module import errors.
Project Configuration
package.json
Click to expand
tsconfig.json
Click to expand
vite.config.ts
Click to expand
Error Messages
Initial Error
When running
npm run start
, I get this error:Error After Setting
"type": "module"
in package.jsonAfter setting
"type": "module"
in the package.json or using the .mjs extension, I get the following error:Question
Has anyone encountered similar issues with Remix, Vite, and MUI? Any suggestions on how to resolve this ESM/CommonJS conflict would be greatly appreciated.
Additional Context
Beta Was this translation helpful? Give feedback.
All reactions