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

[Bug]: No export when export function with eval usage #476

Open
Timeless0911 opened this issue Nov 25, 2024 · 1 comment
Open

[Bug]: No export when export function with eval usage #476

Timeless0911 opened this issue Nov 25, 2024 · 1 comment
Assignees
Labels
🐞 bug Something isn't working

Comments

@Timeless0911
Copy link
Collaborator

Timeless0911 commented Nov 25, 2024

Before

Source

export function add(a: number, b: number) {
  return a + b;
}

Output

function add(a, b) {
    return a + b;
}
export { add };

Current

If we use eval in a function

Source

export function add(a: number, b: number) {
  return a + b;
}

export function evalFunc() {
  return eval('1');
}

Output

// The require scope
var __webpack_require__ = {};
/************************************************************************/ // webpack/runtime/define_property_getters
(()=>{
    __webpack_require__.d = function(exports, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
// webpack/runtime/has_own_property
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
// webpack/runtime/make_namespace_object
(()=>{
    // define __esModule on exports
    __webpack_require__.r = function(exports) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports, '__esModule', {
            value: true
        });
    };
})();
/************************************************************************/ var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    add: function() {
        return add;
    },
    evalFunc: function() {
        return evalFunc;
    }
});
function add(a, b) {
    return a + b;
}
function evalFunc() {
    return eval('1');
}
@Timeless0911 Timeless0911 added the 🐞 bug Something isn't working label Nov 25, 2024
@fi3ework fi3ework self-assigned this Nov 25, 2024
@fi3ework
Copy link
Member

Currently, entry module is required to be concatenated, eval will break the premise.

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