Skip to content

Commit

Permalink
fix: move ipx to optional dependencies (#403)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Heneise <[email protected]>
  • Loading branch information
pi0 and PatrickHeneise authored Sep 5, 2021
1 parent 026be95 commit 0affa9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"fs-extra": "^10.0.0",
"hasha": "^5.2.2",
"image-meta": "^0.0.1",
"ipx": "^0.7.1",
"is-https": "^4.0.0",
"lru-cache": "^6.0.0",
"node-fetch": "^2.6.1",
Expand Down Expand Up @@ -70,6 +69,9 @@
"typescript": "latest",
"vue-jest": "latest"
},
"optionalDependencies": {
"ipx": "^0.7.1"
},
"publishConfig": {
"access": "public"
},
Expand Down
5 changes: 5 additions & 0 deletions src/ipx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export const ipxSetup: ProviderSetup = async (_providerOptions, moduleOptions, n

if (!hasUserProvidedIPX) {
const { createIPX, createIPXMiddleware } = await import('ipx')
.catch((err) => {
// eslint-disable-next-line no-console
console.error('[@nuxt/image] `ipx` is an optional dependency for local image optimization and is not properly installed. Please try `npm install` or `yarn install` again.')
throw new Error(err)
})
const ipx = createIPX(ipxOptions)
nuxt.options.serverMiddleware.push({
path: '/_ipx',
Expand Down

0 comments on commit 0affa9d

Please sign in to comment.