You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Locally it all works perfectly but when deploying on fly.io I get this error.
2024-05-06T00:10:26.269 app[d89d97ea6d9768] fra [info] (node:410) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
2024-05-06T00:10:26.269 app[d89d97ea6d9768] fra [info] (Use `node --trace-warnings ...` to show where the warning was created)
2024-05-06T00:10:26.276 app[d89d97ea6d9768] fra [info] SyntaxError: Cannot use import statement outside a module
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] /myapp/node_modules/@tippyjs/react/headless/dist/tippy-react-headless.esm.js:1
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] import tippy, { createSingleton } from 'tippy.js/headless';
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] ^^^^^^
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] SyntaxError: Cannot use import statement outside a module
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at internalCompileFunction (node:internal/vm:128:18)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at wrapSafe (node:internal/modules/cjs/loader:1280:20)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at Module._compile (node:internal/modules/cjs/loader:1332:27)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at Object.Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at Module.load (node:internal/modules/cjs/loader:1206:32)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at Function.Module._load (node:internal/modules/cjs/loader:1022:12)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at cjsLoader (node:internal/modules/esm/translators:366:17)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:315:7)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
2024-05-06T00:10:26.277 app[d89d97ea6d9768] fra [info] at ModuleLoader.import (node:internal/modules/esm/loader:3
I then tried both approaches from the Remix doc but no luck.
import { vitePlugin as remix } from '@remix-run/dev'
import { flatRoutes } from 'remix-flat-routes'
import { defineConfig } from 'vite'
const MODE = process.env.NODE_ENV
export default defineConfig({
ssr: {
noExternal: ['@tippyjs/react/headless'],
},
build: {
cssMinify: MODE === 'production',
rollupOptions: {
external: [/node:.*/, 'stream', 'crypto', 'fsevents'],
},
},
server: {
cors: false,
},
plugins: [
remix({
ignoredRouteFiles: ['**/*'],
serverModuleFormat: 'esm',
routes: async defineRoutes => {
return flatRoutes('routes', defineRoutes, {
ignoredRouteFiles: [
'.*',
'**/*.css',
'**/*.test.{js,jsx,ts,tsx}',
'**/__*.*',
// This is for server-side utilities you want to colocate next to
// your routes without making an additional directory.
// If you need a route that includes "server" or "client" in the
// filename, use the escape brackets like: my-route.[server].tsx
'**/*.server.*',
'**/*.client.*',
],
})
},
}),
// cjsInterop({
// dependencies: ['@tippyjs/react/headless'],
// }),
],
})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey guys,
Here is the faulty file.
Locally it all works perfectly but when deploying on fly.io I get this error.
I then tried both approaches from the Remix doc but no luck.
Any ideas how do I fix that?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions