Closed kidyfirst closed 5 years ago
typescript module: import fp from 'fastify-plugin' import IFastifyInstance from '@airpay-sz/admin-common/dist/ts/types/IFastifyInstance'
export default fp( (fastify: IFastifyInstance) => { fastify.decorate('timestamp', function() { return Date.now() }) }, { name: 'fastify-timestamp' } ) tsc to js code "use strict"; var importDefault = (this && this.importDefault) || function (mod) { return (mod && mod.esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "esModule", { value: true }); const fastify_plugin_1 = __importDefault(require("fastify-plugin")); exports = fastify_plugin_1.default((fastify) => { fastify.decorate('timestamp', function () { return Date.now(); }); }, { fastify: '>=2.x', name: 'fastify-timestamp' }); the js code can't be load by fastify-plugin Boot.prototype.use = function (plugin, opts) { if (typeof plugin === 'function') { // the plugin is an object this._addPlugin(plugin, opts, false) } else { throw new Error('plugin must be a function') }
return this }
typescript module: import fp from 'fastify-plugin' import IFastifyInstance from '@airpay-sz/admin-common/dist/ts/types/IFastifyInstance'
export default fp( (fastify: IFastifyInstance) => { fastify.decorate('timestamp', function() { return Date.now() }) }, { name: 'fastify-timestamp' } ) tsc to js code "use strict"; var importDefault = (this && this.importDefault) || function (mod) { return (mod && mod.esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "esModule", { value: true }); const fastify_plugin_1 = __importDefault(require("fastify-plugin")); exports = fastify_plugin_1.default((fastify) => { fastify.decorate('timestamp', function () { return Date.now(); }); }, { fastify: '>=2.x', name: 'fastify-timestamp' }); the js code can't be load by fastify-plugin Boot.prototype.use = function (plugin, opts) { if (typeof plugin === 'function') { // the plugin is an object this._addPlugin(plugin, opts, false) } else { throw new Error('plugin must be a function') }
return this }