Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A warning occurred at build time #16

Open
jinchaofs opened this issue Feb 8, 2022 · 1 comment
Open

A warning occurred at build time #16

jinchaofs opened this issue Feb 8, 2022 · 1 comment

Comments

@jinchaofs
Copy link

code

import path from 'path';
import { esbuildDecorators } from '@anatine/esbuild-decorators';
import { build } from "esbuild"
build({
    entryPoints: [path.resolve('src/server/main.ts')],
    bundle: true,
    outfile: 'out.js',
    platform: 'node',
    target: 'node14',
    bundle: true,
    sourcemap: 'external',
    plugins: [
        esbuildDecorators({
            tsconfigPath: path.resolve('tsconfig.server.json'),
            force: true,
        }),
    ],
})
.catch(() => process.exit(1));

warning

▲ [WARNING] Top-level "this" will be replaced with undefined since this file is an ECMAScript module

    src/server/controller/HomeController.ts:1:18:
      1 │ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        │                   ~~~~
        ╵                   undefined

  This file is considered to be an ECMAScript module because of the "export" keyword here:

    src/server/controller/HomeController.ts:25:0:
      25 │ export { HomeController };~~~~~~

Done in 1.67s.
@Brian-McBride
Copy link
Contributor

This is likely a esbuild issue.

The code you put up above is the build command. I don't have time in the next week or so to look into this. You might try the esbuild CLI as a starting point. You'll have to set up your own config, but that is where I'd look.

There is a chance that esbuild needs more options set or this plugin could use more options added. Feel free to put in a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants