@teambit/react 0.0.690 → 0.0.693
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.
- package/apps/web/react-app-options.ts +5 -0
- package/apps/web/react.app-type.ts +2 -1
- package/apps/web/react.application.ts +21 -2
- package/artifacts/env-template/public/283.js +34 -1
- package/artifacts/env-template/public/420.js +74 -1
- package/artifacts/env-template/public/677.js +4 -1
- package/artifacts/env-template/public/750.js +86 -2
- package/artifacts/env-template/public/793.js +744 -16
- package/artifacts/env-template/public/934.js +30 -1
- package/artifacts/env-template/public/assets-manifest.json +10 -10
- package/artifacts/env-template/public/compositions.54cedf393c7a2f90de37.js +1 -0
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/overview.285734acef6c338b6d42.js +5 -0
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/peers.b1e5a815a97146071b4a.js +1 -0
- package/artifacts/env-template/public/preview-root.406bbcb02c30b45c68e6.js +1 -0
- package/artifacts/env-template/public/runtime.js +1 -1
- package/artifacts/env-template/public/service-worker.js +1 -1
- package/artifacts/env-template/public/static/css/{793.539a9611.css → 793.253dc893.css} +1 -1
- package/artifacts/preview/teambit_react_react-preview.js +11 -1
- package/{compositions-1648265027481.js → compositions-1648524148272.js} +0 -0
- package/dist/apps/web/react-app-options.d.ts +4 -0
- package/dist/apps/web/react.app-type.js +1 -1
- package/dist/apps/web/react.app-type.js.map +1 -1
- package/dist/apps/web/react.application.d.ts +2 -1
- package/dist/apps/web/react.application.js +45 -3
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/webpack/webpack.config.base.prod.js +52 -37
- package/dist/webpack/webpack.config.base.prod.js.map +1 -1
- package/{overview-1648265027481.js → overview-1648524148272.js} +0 -0
- package/package-tar/teambit-react-0.0.693.tgz +0 -0
- package/package.json +29 -27
- package/{preview-1648265027481.js → preview-1648524148272.js} +2 -2
- package/webpack/webpack.config.base.prod.ts +50 -34
- package/artifacts/env-template/public/compositions.e8531c3d51e6aac51919.js +0 -1
- package/artifacts/env-template/public/overview.43931650ae35d40d2453.js +0 -1
- package/artifacts/env-template/public/peers.f0c76108cfe204de95bd.js +0 -1
- package/artifacts/env-template/public/preview-root.a1f71de58f10102ed2c6.js +0 -1
- package/package-tar/teambit-react-0.0.690.tgz +0 -0
|
@@ -2,6 +2,8 @@ import { join, basename } from 'path';
|
|
|
2
2
|
import { Application, AppContext, AppBuildContext } from '@teambit/application';
|
|
3
3
|
import { Bundler, DevServer, BundlerContext, DevServerContext, BundlerHtmlConfig } from '@teambit/bundler';
|
|
4
4
|
import { Port } from '@teambit/toolbox.network.get-port';
|
|
5
|
+
import { remove } from 'lodash';
|
|
6
|
+
import TerserPlugin from 'terser-webpack-plugin';
|
|
5
7
|
import { WebpackConfigTransformer } from '@teambit/webpack';
|
|
6
8
|
import { ReactEnv } from '../../react.env';
|
|
7
9
|
import { prerenderSPAPlugin } from './plugins';
|
|
@@ -19,9 +21,9 @@ export class ReactApp implements Application {
|
|
|
19
21
|
readonly bundler?: Bundler,
|
|
20
22
|
readonly devServer?: DevServer,
|
|
21
23
|
readonly transformers?: WebpackConfigTransformer[],
|
|
22
|
-
readonly deploy?: (context: ReactDeployContext) => Promise<void
|
|
24
|
+
readonly deploy?: (context: ReactDeployContext) => Promise<void>,
|
|
25
|
+
readonly favicon?: string
|
|
23
26
|
) {}
|
|
24
|
-
|
|
25
27
|
readonly applicationType = 'react-common-js';
|
|
26
28
|
readonly dir = 'public';
|
|
27
29
|
async run(context: AppContext): Promise<number> {
|
|
@@ -57,6 +59,7 @@ export class ReactApp implements Application {
|
|
|
57
59
|
title: context.name,
|
|
58
60
|
templateContent: html(context.name),
|
|
59
61
|
minify: false,
|
|
62
|
+
favicon: this.favicon,
|
|
60
63
|
// filename: ''.html`,
|
|
61
64
|
},
|
|
62
65
|
];
|
|
@@ -100,6 +103,21 @@ export class ReactApp implements Application {
|
|
|
100
103
|
const defaultTransformer: WebpackConfigTransformer = (configMutator) => {
|
|
101
104
|
const config = configMutator.addTopLevel('output', { path: staticDir, publicPath: `/` });
|
|
102
105
|
if (this.prerenderRoutes) config.addPlugin(prerenderSPAPlugin(this.prerenderRoutes, staticDir));
|
|
106
|
+
if (config.raw.optimization?.minimizer) {
|
|
107
|
+
remove(config.raw.optimization?.minimizer, (minimizer) => {
|
|
108
|
+
return minimizer.constructor.name === 'TerserPlugin';
|
|
109
|
+
});
|
|
110
|
+
config.raw.optimization?.minimizer.push(
|
|
111
|
+
new TerserPlugin({
|
|
112
|
+
minify: TerserPlugin.esbuildMinify,
|
|
113
|
+
// `terserOptions` options will be passed to `esbuild`
|
|
114
|
+
// Link to options - https://esbuild.github.io/api/#minify
|
|
115
|
+
terserOptions: {
|
|
116
|
+
minify: true,
|
|
117
|
+
},
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
}
|
|
103
121
|
return config;
|
|
104
122
|
};
|
|
105
123
|
const transformers = [defaultTransformer, ...(this.transformers ?? [])];
|
|
@@ -117,6 +135,7 @@ export class ReactApp implements Application {
|
|
|
117
135
|
rootPath: '',
|
|
118
136
|
publicPath: `public/${this.name}`,
|
|
119
137
|
title: this.name,
|
|
138
|
+
favicon: this.favicon,
|
|
120
139
|
});
|
|
121
140
|
}
|
|
122
141
|
}
|