diff options
author | 2022-03-15 05:19:15 -0700 | |
---|---|---|
committer | 2022-03-15 05:19:15 -0700 | |
commit | 79caba950682f9c2fa65e064fad542cf808edfe2 (patch) | |
tree | 46ccb092a499cf1e2dc3665a9ea0bb917e8164b5 | |
parent | 7083ef47bb8b31f545eada86eec781dfe00b3323 (diff) | |
download | bun-79caba950682f9c2fa65e064fad542cf808edfe2.tar.gz bun-79caba950682f9c2fa65e064fad542cf808edfe2.tar.zst bun-79caba950682f9c2fa65e064fad542cf808edfe2.zip |
Load .env by default
-rw-r--r-- | src/javascript/jsc/api/transpiler.zig | 1 | ||||
-rw-r--r-- | src/options.zig | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/javascript/jsc/api/transpiler.zig b/src/javascript/jsc/api/transpiler.zig index 1022f5a24..c4075e3e8 100644 --- a/src/javascript/jsc/api/transpiler.zig +++ b/src/javascript/jsc/api/transpiler.zig @@ -546,6 +546,7 @@ pub fn constructor( }; bundler.configureLinkerWithAutoJSX(false); + bundler.options.env.behavior = .disable; bundler.configureDefines() catch |err| { if ((log.warnings + log.errors) > 0) { var out_exception = log.toJS(ctx.ptr(), getAllocator(ctx), "Failed to load define"); diff --git a/src/options.zig b/src/options.zig index 841b0b6d7..6017db9dd 100644 --- a/src/options.zig +++ b/src/options.zig @@ -1322,11 +1322,13 @@ pub const BundleOptions = struct { // If we're doing SSR, we want all the URLs to be the same as what it would be in the browser // If we're not doing SSR, we want all the import paths to be absolute opts.import_path_format = if (opts.import_path_format == .absolute_url) .absolute_url else .absolute_path; + opts.env.behavior = .load_all; }, else => {}, } const is_generating_bundle = (transform.generate_node_module_bundle orelse false); + // if (!(transform.generate_node_module_bundle orelse false)) { if (node_modules_bundle_existing) |node_mods| { opts.node_modules_bundle = node_mods; @@ -1437,12 +1439,17 @@ pub const BundleOptions = struct { opts.main_fields = transform.main_fields; } + if (opts.framework == null and is_generating_bundle) + opts.env.behavior = .load_all; + opts.external = ExternalModules.init(allocator, &fs.fs, fs.top_level_dir, transform.external, log, opts.platform); opts.out_extensions = opts.platform.outExtensions(allocator); if (transform.serve orelse false) { opts.preserve_extensions = true; opts.append_package_version_in_query_string = true; + if (opts.framework == null) + opts.env.behavior = .load_all; opts.sourcemap = SourceMapOption.fromApi(transform.source_map orelse Api.SourceMapMode.external); |