diff options
author | 2021-06-27 23:36:35 -0700 | |
---|---|---|
committer | 2021-06-27 23:36:35 -0700 | |
commit | adbeb2497929d73885f9bd9911beb76bcecc2223 (patch) | |
tree | 46a5d15fdc456214b4a1c70ec5a5f6eae06ad149 /src/js_parser/js_parser.zig | |
parent | b918e7e372fce947ffcfffb0e412c34bb2c6174a (diff) | |
download | bun-adbeb2497929d73885f9bd9911beb76bcecc2223.tar.gz bun-adbeb2497929d73885f9bd9911beb76bcecc2223.tar.zst bun-adbeb2497929d73885f9bd9911beb76bcecc2223.zip |
starting to work
Former-commit-id: ae113559c6dd1e1e77b69ee5edee93fe59b4be2e
Diffstat (limited to 'src/js_parser/js_parser.zig')
-rw-r--r-- | src/js_parser/js_parser.zig | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig index 39c3af492..d4490a1c5 100644 --- a/src/js_parser/js_parser.zig +++ b/src/js_parser/js_parser.zig @@ -1611,6 +1611,9 @@ pub const Parser = struct { filepath_hash_for_hmr: u32 = 0, features: RuntimeFeatures = RuntimeFeatures{}, + // When platform is set to "speedy" + force_commonjs: bool = false, + // Used when bundling node_modules enable_bundling: bool = false, transform_require_to_import: bool = true, @@ -3132,8 +3135,13 @@ pub fn NewParser( p.hoistSymbols(p.module_scope); - p.exports_ref = try p.declareSymbol(.hoisted, logger.Loc.Empty, "exports"); - p.module_ref = try p.declareSymbol(.hoisted, logger.Loc.Empty, "module"); + if (p.options.force_commonjs) { + p.exports_ref = try p.declareCommonJSSymbol(.unbound, "exports"); + p.module_ref = try p.declareCommonJSSymbol(.unbound, "module"); + } else { + p.exports_ref = try p.declareSymbol(.hoisted, logger.Loc.Empty, "exports"); + p.module_ref = try p.declareSymbol(.hoisted, logger.Loc.Empty, "module"); + } if (p.options.enable_bundling) { p.bundle_export_ref = try p.declareSymbol(.unbound, logger.Loc.Empty, "IF_YOU_SEE_THIS_ITS_A_BUNDLER_BUG_PLEASE_FILE_AN_ISSUE_THX"); |