aboutsummaryrefslogtreecommitdiff
path: root/src/options.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.zig')
-rw-r--r--src/options.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/options.zig b/src/options.zig
index a189c4d7a..41fd49a25 100644
--- a/src/options.zig
+++ b/src/options.zig
@@ -1407,11 +1407,30 @@ pub const BundleOptions = struct {
minify_whitespace: bool = false,
minify_syntax: bool = false,
+ // This is a list of packages which even when require() is used, we will
+ // instead convert to ESM import statements.
+ //
+ // This is not normally a safe transformation.
+ //
+ // So we have a list of packages which we know are safe to do this with.
+ unwrap_commonjs_packages: []const string = default_unwrap_commonjs_packages,
+
pub fn setProduction(this: *BundleOptions, value: bool) void {
this.production = value;
this.jsx.development = !value;
}
+ pub const default_unwrap_commonjs_packages = [_]string{
+ "__bun-test-unwrap-commonjs__",
+ "react",
+ "react-client",
+ "react-dom",
+ "react-is",
+ "react-refresh",
+ "react-server",
+ "scheduler",
+ };
+
pub inline fn cssImportBehavior(this: *const BundleOptions) Api.CssInJsBehavior {
switch (this.platform) {
.neutral, .browser => {