lasso-js / lasso

Advanced JavaScript module bundler, asset pipeline and optimizer
582 stars 75 forks source link

serveStatic not work with Fastify #250

Open lyquocnam opened 7 years ago

lyquocnam commented 7 years ago

if i try to use:

fastify.use(require('lasso/middleware').serveStatic());

this error:

/Users/lynam/Documents/dev/marko/node_modules/lasso/middleware/serveStatic.js:47
        if (!path.startsWith(routePrefix) || (req.method !== 'GET' && req.method !== 'HEAD')) {
                 ^

TypeError: Cannot read property 'startsWith' of undefined
    at /Users/lynam/Documents/dev/marko/node_modules/lasso/middleware/serveStatic.js:47:18
    at Holder.done (/Users/lynam/Documents/dev/marko/node_modules/middie/middie.js:90:11)

and if not use, assets could not be found.

screen shot 2017-11-02 at 12 00 19 am