Can't use ipx in serverMiddleware with @nuxt/bridge
See original GitHub issueWhen adding /server/middleware/ipx.js
to nuxt.config.js
(as indicated at https://image.nuxtjs.org/providers/ipx/#advanced-custom-servermiddleware) while using @nuxt/bridge…
import { createIPX, createIPXMiddleware } from 'ipx'
const ipx = createIPX({
dir: '',
domains: [],
alias: {},
sharp: {},
})
export default createIPXMiddleware(ipx)
it results in an error:
WARN [worker] Named export 'stat' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'fs-extra';
const { stat, readFile } = pkg;
import { stat, readFile } from 'fs-extra';
^^^^
SyntaxError: Named export 'stat' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'fs-extra';
const { stat, readFile } = pkg;
at ModuleJob._instantiate (internal/modules/esm/module_job.js:121:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:166:5)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top Results From Across the Web
The serverMiddleware Property - Nuxt
This allows you to create a client API/server API pattern using Nuxt alone. This means that from the browser (for example, within a...
Read more >Nuxt - server middleware not working on production
I have builded an app using Nuxt and I have created simply server middleware for handling email sending. Everything is working on dev...
Read more >My take on using Nuxt with an API - Alexander Lichter's blog
There are three common ways to integrate an API with Nuxt. In this blog post, I'll share my personal opinion regarding all of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pi0, Can we use this pattern?
This is still unfortunately the only thing that is holding me back from using @nuxt/bridge. Is
/server/middleware
no longer viable in Nuxt 3 or Bridge?