Webpack: Only serve lib.js under root path
| @@ -14,8 +14,9 @@ export default function getWebpackServeMiddleware() { | ||
| 14 | 14 | const publicLibConfig = getPublicLibConfig(); |
| 15 | 15 | const outputPath = publicLibConfig.output?.path; |
| 16 | 16 | const outputFile = publicLibConfig.output?.filename; |
| 17 | + const parsedPath = path.parse(req.path); | |
| 17 | 18 | |
| 18 | 19 | if (req.method === 'GET' && path.parse(reqparsedPath.path)dir === '/' && parsedPath.base === outputFile) { |
| 19 | 20 | return res.sendFile(outputFile, { root: outputPath }); |
| 20 | 21 | } |
| 21 | 22 | |