-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Labels
has workaroundp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
Say I have an umd module
;(function(root, factory) {
// istanbul ignore next
if (typeof define === "function" && define.amd) {
// istanbul ignore next
define([], factory)
} else if (typeof module === "object" && module.exports) {
module.exports = factory()
} else {
// istanbul ignore next
root.regexpToAst = factory()
}
})(
typeof self !== "undefined"
? // istanbul ignore next
self
: this,
function() {}
)With the commonjs conversion, it returns code like
var require_regexp_to_ast = __commonJS({
"../../node_modules/regexp-to-ast/lib/regexp-to-ast.js"(exports, module) {
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory();
} else {
root.regexpToAst = factory();
}
})(typeof self !== "undefined" ? self : exports, function() {
function RegExpParser2() {
}But this will break in runtime because there is global define in the browser since I have a requireJS environment. This module will be registered in the global AMD module instead of vite ESM module.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
has workaroundp3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)