2018-10-12 22:31:19 +00:00
|
|
|
const middleware = {}
|
2019-09-10 09:51:14 +00:00
|
|
|
<%= isTest ? '/* eslint-disable dot-notation */' : '' %>
|
2019-09-02 10:53:52 +00:00
|
|
|
<% for (const m of middleware) {
|
|
|
|
// TODO: remove duplicate logic in v3 (see builder.resolveMiddleware)
|
|
|
|
const name = m.name || m.src.replace(new RegExp(`\\.(${extensions})$`), '')
|
|
|
|
const dst = m.dst || relativeToBuild(srcDir, dir.middleware, m.src)
|
2019-01-29 09:31:14 +00:00
|
|
|
%>
|
2019-09-10 09:51:14 +00:00
|
|
|
middleware['<%= name %>'] = require('<%= dst %>')
|
2019-01-29 09:31:14 +00:00
|
|
|
middleware['<%= name %>'] = middleware['<%= name %>'].default || middleware['<%= name %>']
|
2019-09-02 10:53:52 +00:00
|
|
|
<% } %>
|
2019-09-10 09:51:14 +00:00
|
|
|
<%= isTest ? '/* eslint-enable dot-notation */' : '' %>
|
2017-02-03 14:09:27 +00:00
|
|
|
export default middleware
|