es-dev-server-rollup
es-dev-server-rollup copied to clipboard
commonjs proxy sometimes serves without a file
Occasionally, eds attempted to fetch this URL:
http://localhost:8000/__es-dev-server__/?es-dev-server-rollup-null-byte=%00commonjsHelpers.js
When it should have fetched
http://localhost:8000/__es-dev-server__/commonjsHelpers.js?es-dev-server-rollup-null-byte=%00commonjsHelpers.js
I noticed this when using @open-wc/demoing-storybook
, because it crashed the page. The same url resolved to the script when running my app through eds 🤷♂️
@LarsDenBakker solved it for me with:
middlewares: [
(ctx, next) => {
if (ctx.url === '/__es-dev-server__/?es-dev-server-rollup-null-byte=%00commonjsHelpers.js') {
ctx.url = '/__es-dev-server__/commonjsHelpers.js?es-dev-server-rollup-null-byte=%00commonjsHelpers.js';
}
return next();
}
]
He also mentioned this should be fixed inside eds, and that it might be related to history API fallback.
He also said he promises to use es-module-lexer to auto-discover cjs modules so that users don't need to manually include/exclude 😛