{"action":"created","issue":{"url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/issues/80","repository_url":"https://api.github.com/repos/shellscape/webpack-plugin-serve","labels_url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/issues/80/comments","events_url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/issues/80/events","html_url":"https://github.com/shellscape/webpack-plugin-serve/issues/80","id":395610204,"node_id":"MDU6SXNzdWUzOTU2MTAyMDQ=","number":80,"title":"Allow resolution of .html files when no extension is requested","user":{"login":"mindpivot","id":1554893,"node_id":"MDQ6VXNlcjE1NTQ4OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1554893?v=4","gravatar_id":"","url":"https://api.github.com/users/mindpivot","html_url":"https://github.com/mindpivot","followers_url":"https://api.github.com/users/mindpivot/followers","following_url":"https://api.github.com/users/mindpivot/following{/other_user}","gists_url":"https://api.github.com/users/mindpivot/gists{/gist_id}","starred_url":"https://api.github.com/users/mindpivot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mindpivot/subscriptions","organizations_url":"https://api.github.com/users/mindpivot/orgs","repos_url":"https://api.github.com/users/mindpivot/repos","events_url":"https://api.github.com/users/mindpivot/events{/privacy}","received_events_url":"https://api.github.com/users/mindpivot/received_events","type":"User","site_admin":false},"labels":[{"id":1096071512,"node_id":"MDU6TGFiZWwxMDk2MDcxNTEy","url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/labels/s%C2%B2%20%F0%9F%94%A5%F0%9F%94%A5%20important","name":"s² 🔥🔥 important","color":"FB8C00","default":false},{"id":1096071499,"node_id":"MDU6TGFiZWwxMDk2MDcxNDk5","url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/labels/t%E2%81%B4%20%E2%9C%A8%20feature","name":"t⁴ ✨ feature","color":"8bc34A","default":false},{"id":1096071530,"node_id":"MDU6TGFiZWwxMDk2MDcxNTMw","url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/labels/x%E2%81%B5%20%E2%8B%85%20in%20progress","name":"x⁵ ⋅ in progress","color":"4CAF50","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-01-03T15:18:43Z","updated_at":"2019-01-03T16:51:01Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n  ⚡️ katchow! We 💛 issues.\r\n\r\n  Please - do not - remove this template.\r\n  Please - do not - skip or remove parts of this template.\r\n  Or your issue may be closed.\r\n\r\n  👉🏽 Need help or support? Open a SUPPORT issue instead.\r\n-->\r\n\r\n### Feature Use Case\r\nClient-side rendered apps break when file extensions such as .html are present on the URL. I would like to be able to request a route, `/account/test` for example, and have webpack-plugin-serve resolve to `/account/test.html` (if the corresponding html file is present) without changing the URL on the client (i.e. no redirect). It seems the included koa-static middleware allows for this through an options setting 'extensions', which is an array of file extensions to be resolved by koa. I believe the pattern looks like this:\r\n\r\n`{ extensions: [ '.html', '.htm'] }`\r\n\r\n(honestly, it's unclear to me if the leading period is needed)\r\n\r\n### Feature Proposal\r\nPlease allow for requesting routes without file-extensions which successfully resolve to matching filenames containing specified extensions (or even allowing the behavior for .html files by default). Ideally, this would happen without altering the URL on the client.\r\n\r\n**Example:**\r\na `/dist` directory has been specified as a static path to resolve from site-root, all files are contained within that directory. within that directory is another directory named `account`. within the `account` directory is a file named `test.html`.\r\n\r\nBrowser requests: `/account/test`\r\nwebpack-plugin-serve finds file: `/account/test.html`\r\nWPS returns the contents of the .html file at route `/account/test`.\r\n\r\nPerhaps the most straightforward way to allow for this would be to provide a place to pass options into koa-static along with filesystem paths to resolve?\r\n\r\nThank you!"},"comment":{"url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/issues/comments/451204108","html_url":"https://github.com/shellscape/webpack-plugin-serve/issues/80#issuecomment-451204108","issue_url":"https://api.github.com/repos/shellscape/webpack-plugin-serve/issues/80","id":451204108,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTIwNDEwOA==","user":{"login":"shellscape","id":76371,"node_id":"MDQ6VXNlcjc2Mzcx","avatar_url":"https://avatars1.githubusercontent.com/u/76371?v=4","gravatar_id":"","url":"https://api.github.com/users/shellscape","html_url":"https://github.com/shellscape","followers_url":"https://api.github.com/users/shellscape/followers","following_url":"https://api.github.com/users/shellscape/following{/other_user}","gists_url":"https://api.github.com/users/shellscape/gists{/gist_id}","starred_url":"https://api.github.com/users/shellscape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shellscape/subscriptions","organizations_url":"https://api.github.com/users/shellscape/orgs","repos_url":"https://api.github.com/users/shellscape/repos","events_url":"https://api.github.com/users/shellscape/events{/privacy}","received_events_url":"https://api.github.com/users/shellscape/received_events","type":"User","site_admin":false},"created_at":"2019-01-03T16:51:01Z","updated_at":"2019-01-03T16:51:01Z","author_association":"OWNER","body":"@mindpivot would this kind of an implementation work for you:\r\n\r\n```js\r\n// webpack.config.js\r\nmodule.exports = {\r\n  plugins: [\r\n    new WebpackPluginServe({\r\n      middleware: (app, builtins) =>\r\n        const koaStaticOpts = { ... };\r\n        builtins.static([ ...paths... ], koaStaticOpts);\r\n    })\r\n  ]\r\n};\r\n```\r\n\r\nThe `koaStaticOpts` would get applied to every static path defined in the `[ ...paths... ]` array. "}}
{"actor":{"display_login":"shellscape"}}