@teambit/react 0.0.1051 → 0.0.1053

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.
Files changed (30) hide show
  1. package/apps/web/react-app-options.ts +10 -0
  2. package/apps/web/react.app-type.ts +3 -1
  3. package/apps/web/react.application.ts +21 -12
  4. package/artifacts/env-template/public/{634.d2681e5a2ad2767fbefd.js → 624.339523ffa2713fab9603.js} +2 -2
  5. package/artifacts/env-template/public/assets-manifest.json +10 -10
  6. package/artifacts/env-template/public/{compositions.04c424a5d90c30005ffa.js → compositions.4b3e01aed63b1c37c994.js} +1 -1
  7. package/artifacts/env-template/public/compositions.html +1 -1
  8. package/artifacts/env-template/public/{overview.a8e0c93884aede320257.js → overview.35b05f6ec2e554b6f143.js} +1 -1
  9. package/artifacts/env-template/public/overview.html +1 -1
  10. package/artifacts/env-template/public/{peers.c2f8ce8df3dcc9b2dd2c.js → peers.6c2c2c538bcb0e2f6b7a.js} +1 -1
  11. package/artifacts/env-template/public/{preview-root.39be09d642d15b67bc4f.js → preview-root.2fd58ef41e0ab690a97f.js} +1 -1
  12. package/dist/apps/web/react-app-options.d.ts +8 -0
  13. package/dist/apps/web/react-app-options.js.map +1 -1
  14. package/dist/apps/web/react.app-type.js +1 -1
  15. package/dist/apps/web/react.app-type.js.map +1 -1
  16. package/dist/apps/web/react.application.d.ts +3 -1
  17. package/dist/apps/web/react.application.js +8 -6
  18. package/dist/apps/web/react.application.js.map +1 -1
  19. package/dist/{preview-1683603493223.js → preview-1683776045298.js} +2 -2
  20. package/dist/react.env.d.ts +4 -4
  21. package/dist/react.env.js +10 -10
  22. package/dist/react.env.js.map +1 -1
  23. package/dist/react.main.runtime.d.ts +2 -0
  24. package/dist/react.main.runtime.js +4 -4
  25. package/dist/react.main.runtime.js.map +1 -1
  26. package/package-tar/teambit-react-0.0.1053.tgz +0 -0
  27. package/package.json +31 -31
  28. package/package-tar/teambit-react-0.0.1051.tgz +0 -0
  29. /package/{compositions-1683603493223.js → compositions-1683776045298.js} +0 -0
  30. /package/{overview-1683603493223.js → overview-1683776045298.js} +0 -0
@@ -65,4 +65,14 @@ export type ReactAppOptions = {
65
65
  * favicon for the app. You can pass an abs path (using require.resolve()) or a url.
66
66
  */
67
67
  favicon?: string;
68
+
69
+ /**
70
+ * path to load the webpack instance from
71
+ */
72
+ webpackModulePath?: string;
73
+
74
+ /**
75
+ * path to load the webpack dev server instance from.
76
+ */
77
+ webpackDevServerModulePath?: string;
68
78
  };
@@ -28,7 +28,9 @@ export class ReactAppType implements ApplicationType<ReactAppOptions> {
28
28
  options.devServer,
29
29
  options.webpackTransformers,
30
30
  options.deploy,
31
- options.favicon
31
+ options.favicon,
32
+ options.webpackModulePath,
33
+ options.webpackDevServerModulePath
32
34
  );
33
35
  }
34
36
  }
@@ -35,7 +35,9 @@ export class ReactApp implements Application {
35
35
  readonly devServer?: DevServer,
36
36
  readonly transformers: WebpackConfigTransformer[] = [],
37
37
  readonly deploy?: (context: ReactDeployContext) => Promise<void>,
38
- readonly favicon?: string
38
+ readonly favicon?: string,
39
+ readonly webpackModulePath?: string,
40
+ readonly webpackDevServerModulePath?: string
39
41
  ) {}
40
42
  readonly applicationType = 'react-common-js';
41
43
  readonly dir = 'public';
@@ -51,7 +53,12 @@ export class ReactApp implements Application {
51
53
  }
52
54
 
53
55
  const devServerContext = await this.getDevServerContext(context);
54
- const devServer = this.reactEnv.getDevServer(devServerContext, [addDevServer, setOutput, ...this.transformers]);
56
+ const devServer = this.reactEnv.getDevServer(
57
+ devServerContext,
58
+ [addDevServer, setOutput, ...this.transformers],
59
+ this.webpackModulePath,
60
+ this.webpackDevServerModulePath
61
+ );
55
62
  await devServer.listen(port);
56
63
  return port;
57
64
  }
@@ -115,10 +122,11 @@ export class ReactApp implements Application {
115
122
  previousTasksResults: [],
116
123
  });
117
124
 
118
- const bundler = await this.reactEnv.getBundler(ctx, [
119
- (config) => config.merge([clientConfig()]),
120
- ...this.transformers,
121
- ]);
125
+ const bundler = await this.reactEnv.getBundler(
126
+ ctx,
127
+ [(config) => config.merge([clientConfig()]), ...this.transformers],
128
+ this.webpackModulePath
129
+ );
122
130
 
123
131
  const bundleResult = await bundler.run();
124
132
  return bundleResult[0];
@@ -143,10 +151,11 @@ export class ReactApp implements Application {
143
151
  previousTasksResults: [],
144
152
  });
145
153
 
146
- const bundler = await this.reactEnv.getBundler(ctx, [
147
- (config) => config.merge([ssrConfig()]),
148
- ...this.transformers,
149
- ]);
154
+ const bundler = await this.reactEnv.getBundler(
155
+ ctx,
156
+ [(config) => config.merge([ssrConfig()]), ...this.transformers],
157
+ this.webpackModulePath
158
+ );
150
159
 
151
160
  const bundleResult = await bundler.run();
152
161
  return bundleResult[0];
@@ -246,7 +255,7 @@ export class ReactApp implements Application {
246
255
  ]);
247
256
 
248
257
  const reactEnv = context.env as ReactEnv;
249
- const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers);
258
+ const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers, this.webpackModulePath);
250
259
  return bundler;
251
260
  }
252
261
 
@@ -263,7 +272,7 @@ export class ReactApp implements Application {
263
272
  ]);
264
273
 
265
274
  const reactEnv = context.env as ReactEnv;
266
- const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers);
275
+ const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers, this.webpackModulePath);
267
276
  return bundler;
268
277
  }
269
278