nestjs / serve-static

Serve static websites (SPA's) using Nest framework (node.js) šŸ„¦

Home Page:https://nestjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when set renderPath as regexp

femike opened this issue Ā· comments

I'm submitting a error when set renderPath as regexp


[ ] Regression 
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

I get the following error

/project-root/node_modules/find-my-way/index.js:356
  if (path.charCodeAt(0) !== 47) { // 47 is '/'
        ^
TypeError: path.charCodeAt is not a function

Current behavior

@Module({
  imports: [
    ServeStaticModule.forRoot({
      renderPath:
        /^\/(js|css|fonts|icons|locales|index\.html\??)\/?.+$|\/(robots\.txt|favicon\.ico)$/,
      rootPath: join(APP_ROOT_PATH, 'public'),
    }),
    ...
  controllers: [AppControllers],
})
export class AppModule {}  

## Environment

<pre><code>
Nest version: 8.0.0
 
For Tooling issues:
- Node version: v14.17.3
- Platform:  Linux

Others: @nestjs/platform-fastify 
</code></pre>

Fastify doesn't support passing RegExp instances as route URLs https://www.fastify.io/docs/latest/Routes/.
I'll add a note in the README