@lwrjs/module-bundler 0.9.0-alpha.16 → 0.9.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,7 @@ async function bundle(id, moduleGraphs, minify = false) {
49
49
  }
50
50
  async function amdBundler(moduleId, moduleRegistry, minify = false, runtimeEnvironment, runtimeParams = {}, {bundleConfig, amdLoader}, bundleConfigOverrides) {
51
51
  const {exclude, external = {}} = (0, import_bundle_common.overrideBundleConfig)(bundleConfig, bundleConfigOverrides);
52
+ const externalsArray = Object.keys(external);
52
53
  const requiredImports = new Map();
53
54
  const dynamicImports = new Map();
54
55
  const includedModules = [];
@@ -58,7 +59,9 @@ async function amdBundler(moduleId, moduleRegistry, minify = false, runtimeEnvir
58
59
  static: import_shared_utils.GraphDepth.ALL,
59
60
  dynamic: 0,
60
61
  includeId: (moduleRef) => {
61
- if (exclude?.includes(moduleRef.specifier) || moduleRef.specifier === amdLoader) {
62
+ if (externalsArray.includes(moduleRef.specifier) || moduleRef.specifier === amdLoader) {
63
+ return false;
64
+ } else if (exclude?.includes(moduleRef.specifier)) {
62
65
  requiredImports.set(`${moduleRef.specifier}_${moduleRef.version}`, moduleRef);
63
66
  return false;
64
67
  }
@@ -22,6 +22,7 @@ async function bundle(id, moduleGraphs, minify = false) {
22
22
  }
23
23
  export async function amdBundler(moduleId, moduleRegistry, minify = false, runtimeEnvironment, runtimeParams = {}, { bundleConfig, amdLoader }, bundleConfigOverrides) {
24
24
  const { exclude, external = {} } = overrideBundleConfig(bundleConfig, bundleConfigOverrides);
25
+ const externalsArray = Object.keys(external);
25
26
  const requiredImports = new Map();
26
27
  const dynamicImports = new Map();
27
28
  const includedModules = [];
@@ -31,8 +32,15 @@ export async function amdBundler(moduleId, moduleRegistry, minify = false, runti
31
32
  static: GraphDepth.ALL,
32
33
  dynamic: 0,
33
34
  includeId: (moduleRef) => {
34
- // loader should be auto bundled with shim already
35
- if (exclude?.includes(moduleRef.specifier) || moduleRef.specifier === amdLoader) {
35
+ // Do not bundle externals, including the loader module, which is auto bundled
36
+ // with the shim + loader combo
37
+ if (externalsArray.includes(moduleRef.specifier) || moduleRef.specifier === amdLoader) {
38
+ // Do not include externals in the required imports but also return false to indicate it should not be in the bundle
39
+ return false;
40
+ }
41
+ else if (exclude?.includes(moduleRef.specifier)) {
42
+ // If this is a bundle exclude return false to indicate it should not be in the bundle
43
+ // but add it to the requriedImports so it shows up as a static dependency of the bundle.
36
44
  requiredImports.set(`${moduleRef.specifier}_${moduleRef.version}`, moduleRef);
37
45
  return false;
38
46
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.9.0-alpha.16",
7
+ "version": "0.9.0-alpha.17",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -45,13 +45,13 @@
45
45
  "build/**/*.d.ts"
46
46
  ],
47
47
  "dependencies": {
48
- "@lwrjs/shared-utils": "0.9.0-alpha.16",
48
+ "@lwrjs/shared-utils": "0.9.0-alpha.17",
49
49
  "@rollup/plugin-replace": "^2.4.2",
50
50
  "rollup": "~2.45.2",
51
51
  "rollup-plugin-terser": "^7.0.2"
52
52
  },
53
53
  "devDependencies": {
54
- "@lwrjs/types": "0.9.0-alpha.16"
54
+ "@lwrjs/types": "0.9.0-alpha.17"
55
55
  },
56
56
  "optionalDependencies": {
57
57
  "esbuild": "^0.9.7"
@@ -63,5 +63,5 @@
63
63
  "node": "14.19.1",
64
64
  "yarn": "1.22.19"
65
65
  },
66
- "gitHead": "03fe3982780e7c63b96ef0733b58529057db61fa"
66
+ "gitHead": "447417ff091802927b25cfc1bcb01da02264f41b"
67
67
  }