@teambit/react 0.0.623 → 0.0.630
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/__compositions-1643028743431.js +7 -0
- package/__overview-1643028743431.js +7 -0
- package/__preview-1643028743431.js +2 -0
- package/apps/web/deploy-context.ts +4 -0
- package/apps/web/index.ts +3 -0
- package/apps/web/react-app-options.ts +3 -3
- package/apps/web/react-build-result.ts +9 -0
- package/apps/web/react.application.ts +32 -34
- package/artifacts/env-template/public/141.js +1 -0
- package/artifacts/env-template/public/181.js +1 -0
- package/artifacts/env-template/public/283.js +1 -0
- package/artifacts/env-template/public/664.js +128 -0
- package/artifacts/env-template/public/743.js +1 -0
- package/artifacts/env-template/public/848.js +1 -0
- package/artifacts/env-template/public/assets-manifest.json +74 -0
- package/artifacts/env-template/public/compositions.266a1b82df14e17f5a23.js +1 -0
- package/artifacts/env-template/public/compositions.html +2 -0
- package/artifacts/env-template/public/overview.0f89eba4ac5ae70e0dc7.js +1 -0
- package/artifacts/env-template/public/overview.html +2 -0
- package/artifacts/env-template/public/peers.23d97726152f744ec115.js +1 -0
- package/artifacts/env-template/public/preview-root.b33a2fef3cb8fc3d6479.js +1 -0
- package/artifacts/env-template/public/runtime.js +1 -0
- package/artifacts/env-template/public/service-worker.js +1 -0
- package/artifacts/env-template/public/static/css/664.0a9dfff4.css +1 -0
- package/artifacts/env-template/public/static/css/compositions.cd8be53f.css +1 -0
- package/artifacts/env-template/public/static/css/overview.71e25e30.css +1 -0
- package/artifacts/env-template/public/static/css/previewRoot.5ad41161.css +1 -0
- package/artifacts/env-template/public/workbox-ca45de73.js +1 -0
- package/artifacts/preview/teambit_react_react-preview.js +1 -0
- package/dist/apps/web/deploy-context.d.ts +3 -0
- package/dist/apps/web/deploy-context.js +3 -0
- package/dist/apps/web/deploy-context.js.map +1 -0
- package/dist/apps/web/index.d.ts +3 -0
- package/dist/apps/web/index.js +23 -0
- package/dist/apps/web/index.js.map +1 -0
- package/dist/apps/web/react-app-options.d.ts +2 -3
- package/dist/apps/web/react-app-options.js +0 -10
- package/dist/apps/web/react-app-options.js.map +1 -1
- package/dist/apps/web/react-build-result.d.ts +8 -0
- package/dist/apps/web/react-build-result.js +3 -0
- package/dist/apps/web/react-build-result.js.map +1 -0
- package/dist/apps/web/react.application.d.ts +7 -7
- package/dist/apps/web/react.application.js +41 -29
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.env.d.ts +10 -1
- package/dist/react.env.js +60 -8
- package/dist/react.env.js.map +1 -1
- package/dist/react.main.runtime.js +11 -11
- package/dist/react.main.runtime.js.map +1 -1
- package/dist/templates/react-app/files/app-root.js +7 -1
- package/dist/templates/react-app/files/app-root.js.map +1 -1
- package/dist/templates/react-app/files/compositions.js +1 -1
- package/dist/templates/react-app/files/compositions.js.map +1 -1
- package/dist/templates/workspace-common/files/workspace-config.js +1 -1
- package/dist/templates/workspace-common/files/workspace-config.js.map +1 -1
- package/dist/webpack/get-exposed-rules.d.ts +2 -0
- package/dist/webpack/get-exposed-rules.js +50 -0
- package/dist/webpack/get-exposed-rules.js.map +1 -0
- package/dist/webpack/get-externals.d.ts +1 -0
- package/dist/webpack/get-externals.js +42 -0
- package/dist/webpack/get-externals.js.map +1 -0
- package/dist/webpack/html.d.ts +2 -0
- package/dist/webpack/html.js +31 -0
- package/dist/webpack/html.js.map +1 -0
- package/dist/webpack/index.d.ts +1 -0
- package/dist/webpack/index.js +23 -0
- package/dist/webpack/index.js.map +1 -0
- package/dist/webpack/transformers.d.ts +2 -0
- package/dist/webpack/transformers.js +19 -0
- package/dist/webpack/transformers.js.map +1 -0
- package/dist/webpack/webpack.config.base.js +3 -5
- package/dist/webpack/webpack.config.base.js.map +1 -1
- package/dist/webpack/webpack.config.base.prod.d.ts +1 -1
- package/dist/webpack/webpack.config.base.prod.js +101 -80
- package/dist/webpack/webpack.config.base.prod.js.map +1 -1
- package/package-tar/teambit-react-0.0.630.tgz +0 -0
- package/package.json +38 -36
- package/templates/react-app/files/app-root.ts +7 -1
- package/templates/react-app/files/compositions.ts +1 -1
- package/templates/workspace-common/files/workspace-config.ts +1 -1
- package/webpack/get-exposed-rules.ts +12 -0
- package/webpack/get-externals.ts +8 -0
- package/webpack/html.ts +22 -0
- package/webpack/index.ts +1 -0
- package/webpack/transformers.ts +12 -0
- package/webpack/webpack.config.base.prod.ts +99 -81
- package/webpack/webpack.config.base.ts +3 -5
- package/package-tar/teambit-react-0.0.623.tgz +0 -0
|
@@ -2,78 +2,96 @@ import WorkboxWebpackPlugin from 'workbox-webpack-plugin';
|
|
|
2
2
|
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
3
3
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
4
4
|
import { Configuration } from 'webpack';
|
|
5
|
-
import {
|
|
5
|
+
import { getExternals } from './get-externals';
|
|
6
|
+
import { getExposedRules } from './get-exposed-rules';
|
|
7
|
+
// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
6
8
|
|
|
7
9
|
// This is the production and development configuration.
|
|
8
10
|
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
|
|
9
11
|
// eslint-disable-next-line complexity
|
|
10
|
-
export default function (): Configuration {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
12
|
+
export default function (externalizePeer: boolean, peers: string[], dev?: boolean): Configuration {
|
|
13
|
+
const externals = externalizePeer ? (getExternals(peers) as any) : undefined;
|
|
14
|
+
const exposedRules = externalizePeer ? undefined : getExposedRules(peers);
|
|
15
|
+
|
|
16
|
+
const module = externalizePeer
|
|
17
|
+
? undefined
|
|
18
|
+
: {
|
|
19
|
+
rules: exposedRules,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const optimization = dev
|
|
23
|
+
? undefined
|
|
24
|
+
: {
|
|
25
|
+
minimize: true,
|
|
26
|
+
minimizer: [
|
|
27
|
+
// This is only used in production mode
|
|
28
|
+
new TerserPlugin({
|
|
29
|
+
extractComments: false,
|
|
30
|
+
terserOptions: {
|
|
31
|
+
parse: {
|
|
32
|
+
// We want terser to parse ecma 8 code. However, we don't want it
|
|
33
|
+
// to apply any minification steps that turns valid ecma 5 code
|
|
34
|
+
// into invalid ecma 5 code. This is why the 'compress' and 'output'
|
|
35
|
+
// sections only apply transformations that are ecma 5 safe
|
|
36
|
+
// https://github.com/facebook/create-react-app/pull/4234
|
|
37
|
+
ecma: 8,
|
|
38
|
+
},
|
|
39
|
+
compress: {
|
|
40
|
+
ecma: 5,
|
|
41
|
+
warnings: false,
|
|
42
|
+
// Disabled because of an issue with Uglify breaking seemingly valid code:
|
|
43
|
+
// https://github.com/facebook/create-react-app/issues/2376
|
|
44
|
+
// Pending further investigation:
|
|
45
|
+
// https://github.com/mishoo/UglifyJS2/issues/2011
|
|
46
|
+
comparisons: false,
|
|
47
|
+
// Disabled because of an issue with Terser breaking valid code:
|
|
48
|
+
// https://github.com/facebook/create-react-app/issues/5250
|
|
49
|
+
// Pending further investigation:
|
|
50
|
+
// https://github.com/terser-js/terser/issues/120
|
|
51
|
+
inline: 2,
|
|
52
|
+
},
|
|
53
|
+
mangle: {
|
|
54
|
+
safari10: true,
|
|
55
|
+
},
|
|
56
|
+
output: {
|
|
57
|
+
ecma: 5,
|
|
58
|
+
comments: false,
|
|
59
|
+
// Turned on because emoji and regex is not minified properly using default
|
|
60
|
+
// https://github.com/facebook/create-react-app/issues/2488
|
|
61
|
+
ascii_only: true,
|
|
62
|
+
},
|
|
42
63
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
64
|
+
}),
|
|
65
|
+
new CssMinimizerPlugin({
|
|
66
|
+
minimizerOptions: {
|
|
67
|
+
preset: [
|
|
68
|
+
'default',
|
|
69
|
+
{
|
|
70
|
+
minifyFontValues: { removeQuotes: false },
|
|
71
|
+
},
|
|
72
|
+
],
|
|
49
73
|
},
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
minifyFontValues: { removeQuotes: false },
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
],
|
|
63
|
-
// Automatically split vendor and commons
|
|
64
|
-
// https://twitter.com/wSokra/status/969633336732905474
|
|
65
|
-
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
|
66
|
-
splitChunks: {
|
|
67
|
-
chunks: 'all',
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
// Automatically split vendor and commons
|
|
77
|
+
// https://twitter.com/wSokra/status/969633336732905474
|
|
78
|
+
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
|
79
|
+
// splitChunks: {
|
|
80
|
+
// chunks: 'all',
|
|
68
81
|
// name: false,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
name: (entrypoint) => `runtime-${entrypoint.name}`,
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
// },
|
|
83
|
+
// Keep the runtime chunk separated to enable long term caching
|
|
84
|
+
// https://twitter.com/wSokra/status/969679223278505985
|
|
85
|
+
// https://github.com/facebook/create-react-app/issues/5358
|
|
86
|
+
// runtimeChunk: {
|
|
87
|
+
// name: (entrypoint) => `runtime-${entrypoint.name}`,
|
|
88
|
+
// },
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
module,
|
|
93
|
+
externals,
|
|
94
|
+
optimization,
|
|
77
95
|
|
|
78
96
|
plugins: [
|
|
79
97
|
// Generate an asset manifest file with the following content:
|
|
@@ -81,23 +99,23 @@ export default function (): Configuration {
|
|
|
81
99
|
// output file so that tools can pick it up without having to parse
|
|
82
100
|
// `index.html`
|
|
83
101
|
// can be used to reconstruct the HTML if necessary
|
|
84
|
-
new WebpackManifestPlugin({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
// new WebpackManifestPlugin({
|
|
103
|
+
// fileName: 'asset-manifest.json',
|
|
104
|
+
// publicPath: 'public',
|
|
105
|
+
// generate: (seed, files, entrypoints) => {
|
|
106
|
+
// const manifestFiles = files.reduce((manifest, file) => {
|
|
107
|
+
// manifest[file.name] = file.path;
|
|
108
|
+
// return manifest;
|
|
109
|
+
// }, seed);
|
|
110
|
+
// const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));
|
|
93
111
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}),
|
|
112
|
+
// // @ts-ignore - https://github.com/shellscape/webpack-manifest-plugin/issues/276
|
|
113
|
+
// return {
|
|
114
|
+
// files: manifestFiles,
|
|
115
|
+
// entrypoints: entrypointFiles,
|
|
116
|
+
// } as Record<string, string>;
|
|
117
|
+
// },
|
|
118
|
+
// }),
|
|
101
119
|
// Generate a service worker script that will precache, and keep up to date,
|
|
102
120
|
// the HTML & assets that are part of the webpack build.
|
|
103
121
|
new WorkboxWebpackPlugin.GenerateSW({
|
|
@@ -57,6 +57,8 @@ export default function (isEnvProduction = false): Configuration {
|
|
|
57
57
|
// const env = getClientEnvironment(publicUrlOrPath.slice(0, -1));
|
|
58
58
|
|
|
59
59
|
return {
|
|
60
|
+
// TODO: make the dev tool according to shouldUseSourceMap and isEnvProduction
|
|
61
|
+
// devtool: 'inline-source-map',
|
|
60
62
|
resolve: {
|
|
61
63
|
// These are the reasonable defaults supported by the Node ecosystem.
|
|
62
64
|
// We also include JSX as a common component filename extension to support
|
|
@@ -72,12 +74,8 @@ export default function (isEnvProduction = false): Configuration {
|
|
|
72
74
|
// Support React Native Web
|
|
73
75
|
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
|
|
74
76
|
// TODO: @uri please remember to remove after publishing evangelist and base-ui
|
|
75
|
-
react: require.resolve('react'),
|
|
76
|
-
'@teambit/mdx.ui.mdx-scope-context': require.resolve('@teambit/mdx.ui.mdx-scope-context'),
|
|
77
|
-
'react-dom/server': require.resolve('react-dom/server'),
|
|
78
|
-
'react-dom': require.resolve('react-dom'),
|
|
79
|
-
'@mdx-js/react': require.resolve('@mdx-js/react'),
|
|
80
77
|
|
|
78
|
+
'react-dom/server': require.resolve('react-dom/server'),
|
|
81
79
|
// Allows for better profiling with ReactDevTools
|
|
82
80
|
...(isEnvProductionProfile && {
|
|
83
81
|
'react-dom$': 'react-dom/profiling',
|
|
Binary file
|