Skip to content

Commit da7c661

Browse files
authored
remove server (#3872)
1 parent d317500 commit da7c661

38 files changed

Lines changed: 32 additions & 7704 deletions

babel.config.js

Lines changed: 29 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module.exports = function(api) {
22
api.cache(true);
33

4-
const minify = String(process.env.MINIFY) === 'true';
54
const noModules = String(process.env.BABEL_NO_MODULES) === 'true';
65

76
const rename = {};
@@ -18,71 +17,36 @@ module.exports = function(api) {
1817
const presets = [];
1918
const plugins = [];
2019

21-
if (process.env.SERVER === 'true') {
22-
presets.push([
23-
'@babel/preset-env',
24-
{
25-
loose: true,
26-
exclude: ['@babel/plugin-transform-typeof-symbol'],
27-
targets: {
28-
node: true
29-
}
30-
}
31-
]);
32-
33-
plugins.push(
34-
[
35-
'@babel/plugin-transform-react-jsx',
36-
{ runtime: 'automatic', importSource: 'preact' }
37-
],
38-
['babel-plugin-transform-rename-properties', { rename }],
39-
[
40-
'module-resolver',
41-
{
42-
root: ['.'],
43-
alias: {
44-
'preact/jsx-dev-runtime': './jsx-runtime/src/index.js',
45-
'preact/jsx-runtime': './jsx-runtime/src/index.js',
46-
'preact/test-utils': './test-utils/src/index.js',
47-
'preact/hooks': './hooks/src/index.js',
48-
'preact/compat': './compat/src/index.js',
49-
preact: './src/index.js'
50-
}
51-
}
52-
]
53-
);
54-
} else {
55-
presets.push([
56-
'@babel/preset-env',
57-
{
58-
loose: true,
59-
// Don't transform modules when using esbuild
60-
modules: noModules ? false : 'auto',
61-
exclude: ['@babel/plugin-transform-typeof-symbol'],
62-
targets: {
63-
browsers: [
64-
'Firefox>=60',
65-
'chrome>=61',
66-
'and_chr>=61',
67-
'Safari>=10.1',
68-
'iOS>=10.3',
69-
'edge>=16',
70-
'opera>=48',
71-
'op_mob>=48',
72-
'Samsung>=8.2',
73-
'not dead'
74-
]
75-
}
20+
presets.push([
21+
'@babel/preset-env',
22+
{
23+
loose: true,
24+
// Don't transform modules when using esbuild
25+
modules: noModules ? false : 'auto',
26+
exclude: ['@babel/plugin-transform-typeof-symbol'],
27+
targets: {
28+
browsers: [
29+
'Firefox>=60',
30+
'chrome>=61',
31+
'and_chr>=61',
32+
'Safari>=10.1',
33+
'iOS>=10.3',
34+
'edge>=16',
35+
'opera>=48',
36+
'op_mob>=48',
37+
'Samsung>=8.2',
38+
'not dead'
39+
]
7640
}
77-
]);
78-
79-
plugins.push(
80-
'@babel/plugin-proposal-object-rest-spread',
81-
'@babel/plugin-transform-react-jsx',
82-
'babel-plugin-transform-async-to-promises',
83-
['babel-plugin-transform-rename-properties', { rename }]
84-
);
85-
}
41+
}
42+
]);
43+
44+
plugins.push(
45+
'@babel/plugin-proposal-object-rest-spread',
46+
'@babel/plugin-transform-react-jsx',
47+
'babel-plugin-transform-async-to-promises',
48+
['babel-plugin-transform-rename-properties', { rename }]
49+
);
8650

8751
return {
8852
presets,

compat/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { renderToString } = require('preact/server');
1+
const { renderToString } = require('preact-render-to-string');
22

33
module.exports = {
44
renderToString,

compat/server.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export {
22
renderToString,
33
renderToString as renderToStaticMarkup
4-
} from 'preact/server';
4+
} from 'preact-render-to-string';

package-lock.json

Lines changed: 0 additions & 170 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)