Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move "ipx" into optional dependencies which can be skipped #380

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions src/ipx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const ipxSetup: ProviderSetup = async (_providerOptions, moduleOptions, n

if (!hasUserProvidedIPX) {
const { createIPX, createIPXMiddleware } = await import('ipx')
.catch((err) => {
console.error('[@nuxt/image] `ipx` is an optional dependency for local image optimization. Please run `yarn install -D ipx` / `npm install ipx --save-dev` or use an image provider. You can find more information here: https://image.nuxtjs.org/providers/ipx.')
throw new Error(err)
})
const ipx = createIPX(ipxOptions)
nuxt.options.serverMiddleware.push({
path: '/_ipx',
Expand Down
Loading