-
-
Notifications
You must be signed in to change notification settings - Fork 320
CORS #2564
-
Hi,
I'm just moving from the old es-dev-server and I was using the CORS option but this is no longer available with web-dev-server.
Beta Was this translation helpful? Give feedback.
All reactions
I figured you are referring to https://github.com/open-wc/es-dev-server/blob/98dd47464c97c5ab5fc6ef86723b3f529bc8265c/src/config.ts#L60
Not sure why this feature is not supported natively here, but given it was in the project which WDS was forked from (and is written by same authors), I assume it was removed on purpose. Maybe @LarsDenBakker can add more details?
But don't worry, it's very easy to add it yourself, I'd say so easy that you might not need it out-of-the-box.
Just install and use the import koaCors from '@koa/cors'; and add it to middleware which is an array of Koa middlewares
https://modern-web.dev/docs/dev-server/middleware/#dev-server-middleware
similar to
https://github.co...
Replies: 1 comment
-
I figured you are referring to https://github.com/open-wc/es-dev-server/blob/98dd47464c97c5ab5fc6ef86723b3f529bc8265c/src/config.ts#L60
Not sure why this feature is not supported natively here, but given it was in the project which WDS was forked from (and is written by same authors), I assume it was removed on purpose. Maybe @LarsDenBakker can add more details?
But don't worry, it's very easy to add it yourself, I'd say so easy that you might not need it out-of-the-box.
Just install and use the import koaCors from '@koa/cors'; and add it to middleware which is an array of Koa middlewares
https://modern-web.dev/docs/dev-server/middleware/#dev-server-middleware
similar to
https://github.com/open-wc/es-dev-server/blob/98dd47464c97c5ab5fc6ef86723b3f529bc8265c/src/create-middlewares.ts#L204
Beta Was this translation helpful? Give feedback.