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

type declaration export of the entry module is saved to the runtime #1220

Open
shulandmimi opened this issue Apr 20, 2024 · 1 comment
Open
Labels
bug Something isn't working
Milestone

Comments

@shulandmimi
Copy link
Member

Steps to reproduce

  1. install latest @farmfe/core @farmfe/cli
pnpm install @farmfe/core @farmfe/cli -D
  1. create farm config
// farm.config.ts
import { defineConfig } from '@farmfe/core';

export default defineConfig({
    compilation: {
        presetEnv: false,
        input: {
            main: 'src/main.ts',
        },
    },
});
  1. code
// src/main.ts
import { Person } from './dep';

export { Person };


// src/dep.ts
export interface Person {
  name: string;
}
  1. build
npx farm build

What is expected?

should be cleared at compile time

import { Person } from './dep';

export { Person };

What is actually happening?

to the runtime

// dist/main.js

    ec2bf3a9: function (e, t, n, r) {
        'use strict';
        Object.defineProperty(t, '__esModule', { value: !0 }),
            Object.defineProperty(t, 'Person', {
                enumerable: !0,
                get: function () {
                    return o.Person;
                },
            });
        let o = n('ef454df0');
    },
    ef454df0: function (n, c, f, i) {},

System Info

System:
    OS: Linux 6.7 Arch Linux
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13600KF
    Memory: 14.97 GB / 31.18 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  npmPackages:
    @farmfe/cli: ^1.0.0 => 1.0.0 
    @farmfe/core: ^1.0.22 => 1.0.22

Any additional comments?

After my simple review, it appears in dev and build

@shulandmimi shulandmimi added the bug Something isn't working label Apr 22, 2024
@wre232114 wre232114 added this to the V1.2.0 milestone Apr 22, 2024
@wre232114
Copy link
Member

farm does not know it's type declaration. but it should be removed during tree shake. main.ts is entry so it won't be tree shaken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants