folke / esbuild-runner

⚡️ Super-fast on-the-fly transpilation of modern JS, TypeScript and JSX using esbuild
https://www.npmjs.com/package/esbuild-runner
Apache License 2.0
711 stars 24 forks source link

esbuild plugins not work #29

Closed pincman closed 3 years ago

pincman commented 3 years ago

config

// esbuild-runner.config.js
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const { esbuildDecorators } = require('@anatine/esbuild-decorators');

const tsconfig = path.resolve(__dirname, './tsconfig.json');
const getEsbuildOptions = async () => ({
    // Any esbuild build or transform options go here
    platform: 'node',
    target: 'esnext',
    sourcemap: false,
    plugins: [esbuildDecorators({ tsconfig, cwd: process.cwd() })],
});
const getConfig = async () => ({
    type: 'bundle', // bundle or transform (see description above)
    esbuild: await getEsbuildOptions(),
});
module.exports = getConfig();

bin.js

if (typeof process.env.NODE_ENV === 'undefined') {
    process.env.NODE_ENV = 'development';
}
require('esbuild-runner/register');
require('module-alias/register');

error

ColumnTypeUndefinedError: Column type for PostEntity#title is not defined and cannot be guessed. Make sure you have turned on an "emitDecoratorMetadata": true option in tsconfig.json. Also make sure you have imported "reflect-metadata" on top of the main entry file in your application (before any entity imported).If you are using JavaScript instead of TypeScript you must explicitly provide a column type.
    at new Co
williamoliveira commented 2 years ago

having the same problem, what was your solution?

divmgl commented 1 year ago

@pincman can we get an update here? What was your solution?