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

Incorrect generation output upon running swc on root directory #5644

Closed
isRyven opened this issue Aug 26, 2022 · 1 comment · Fixed by #7656
Closed

Incorrect generation output upon running swc on root directory #5644

isRyven opened this issue Aug 26, 2022 · 1 comment · Fixed by #7656
Assignees
Labels
Milestone

Comments

@isRyven
Copy link

isRyven commented Aug 26, 2022

Describe the bug

Upon running swc on root of my package directory, i am getting broken js entry file.

npx swc --version
@swc/cli: 0.1.57
@swc/core: 1.2.242

npx swc $PWD -d dist
Successfully compiled: 150 files with swc (217.32ms)

dist/index.js

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
_exportStar(require("./web-app"), exports);
_exportStar(require("./middlewares"), exports);
_exportStar(require("./routing"), exports);
_exportStar(require("./http-config"), exports);
_exportStar(require("./context-accessor"), exports);
_exportStar(require("./utils"), exports);
_exportStar(require("./request-context-accessor"), exports);
_exportStar(require("./stub-context-accessor"), exports);
function _exportStar(from, to) {
    Object.keys(from).forEach(function(k) {
        if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
            enumerable: true,
            get: function() {
                return from[k];
            }
        });
    });
    return from;
}

//# sourceMappingURL=index.js.map         return from[k];
            }
        });
    });
    return from;
}

//# sourceMappingURL=index.js.map         get: function() {
                return from[k];
            }
        });
    });
    return from;
}

//# sourceMappingURL=index.js.mapb"), exports);
_exportStar(require("./translation"), exports);
_exportStar(require("./config"), exports);
function _exportStar(from, to) {
    Object.keys(from).forEach(function(k) {
        if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
            enumerable: true,
            get: function() {
                return from[k];
            }
        });
    });
    return from;
}

//# sourceMappingURL=index.js.map

Actual index.ts is just this:

export * from './authentication';
export * from './persistence';
export * from './logging';
export * from './infrastructure';
export * from './domain';
export * from './values';
export * from './domain/rules';
export * from './command';
export * from './query';
export * from './migration';
export * from './amqp';
export * from './event-logging';
export * from './utils';
export * from './cache-driver';
export * from './container';
export * from './common-storage';
export * from './dto';
export * from './search-builder';
export * from './api-response';
export * from './model-context-factory';
export * from './web';
export * from './translation';
export * from './config';

The other compiled files seems to be valid.

Input code

No response

Config

{
    "$schema": "https://json.schemastore.org/swcrc",
    "jsc": {
        "parser": {
            "syntax": "typescript",
            "tsx": false,
            "dts": true,
            "decorators": true,
            "dynamicImport": true
        },
        "transform": {
            "legacyDecorator": true,
            "decoratorMetadata": true
        },
        "target": "es2020",
        "loose": false,
        "externalHelpers": false        
    },
    "test": ".+\\.ts$",
    "module": {
        "type": "commonjs"
    },
    "sourceMaps": true,
    "exclude": [".+\\.spec\\.ts$", ".+\\.d\\.ts$"],
    "minify": false
}

Playground link

No response

Expected behavior

Valid javascript file.

Actual behavior

A broken javascript file.

Version

1.2.242

Additional context

No response

@isRyven isRyven added the C-bug label Aug 26, 2022
@kdy1 kdy1 added this to the Planned milestone Aug 27, 2022
@kdy1 kdy1 self-assigned this Dec 22, 2022
kdy1 added a commit that referenced this issue Jul 13, 2023
@kdy1 kdy1 modified the milestones: Planned, v1.3.70 Jul 18, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Aug 17, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants