Skip to content

Commit

Permalink
remove server (#3872)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Jan 27, 2023
1 parent d317500 commit da7c661
Show file tree
Hide file tree
Showing 38 changed files with 32 additions and 7,704 deletions.
94 changes: 29 additions & 65 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = function(api) {
api.cache(true);

const minify = String(process.env.MINIFY) === 'true';
const noModules = String(process.env.BABEL_NO_MODULES) === 'true';

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

if (process.env.SERVER === 'true') {
presets.push([
'@babel/preset-env',
{
loose: true,
exclude: ['@babel/plugin-transform-typeof-symbol'],
targets: {
node: true
}
}
]);

plugins.push(
[
'@babel/plugin-transform-react-jsx',
{ runtime: 'automatic', importSource: 'preact' }
],
['babel-plugin-transform-rename-properties', { rename }],
[
'module-resolver',
{
root: ['.'],
alias: {
'preact/jsx-dev-runtime': './jsx-runtime/src/index.js',
'preact/jsx-runtime': './jsx-runtime/src/index.js',
'preact/test-utils': './test-utils/src/index.js',
'preact/hooks': './hooks/src/index.js',
'preact/compat': './compat/src/index.js',
preact: './src/index.js'
}
}
]
);
} else {
presets.push([
'@babel/preset-env',
{
loose: true,
// Don't transform modules when using esbuild
modules: noModules ? false : 'auto',
exclude: ['@babel/plugin-transform-typeof-symbol'],
targets: {
browsers: [
'Firefox>=60',
'chrome>=61',
'and_chr>=61',
'Safari>=10.1',
'iOS>=10.3',
'edge>=16',
'opera>=48',
'op_mob>=48',
'Samsung>=8.2',
'not dead'
]
}
presets.push([
'@babel/preset-env',
{
loose: true,
// Don't transform modules when using esbuild
modules: noModules ? false : 'auto',
exclude: ['@babel/plugin-transform-typeof-symbol'],
targets: {
browsers: [
'Firefox>=60',
'chrome>=61',
'and_chr>=61',
'Safari>=10.1',
'iOS>=10.3',
'edge>=16',
'opera>=48',
'op_mob>=48',
'Samsung>=8.2',
'not dead'
]
}
]);

plugins.push(
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-react-jsx',
'babel-plugin-transform-async-to-promises',
['babel-plugin-transform-rename-properties', { rename }]
);
}
}
]);

plugins.push(
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-react-jsx',
'babel-plugin-transform-async-to-promises',
['babel-plugin-transform-rename-properties', { rename }]
);

return {
presets,
Expand Down
2 changes: 1 addition & 1 deletion compat/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { renderToString } = require('preact/server');
const { renderToString } = require('preact-render-to-string');

module.exports = {
renderToString,
Expand Down
2 changes: 1 addition & 1 deletion compat/server.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export {
renderToString,
renderToString as renderToStaticMarkup
} from 'preact/server';
} from 'preact-render-to-string';
170 changes: 0 additions & 170 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit da7c661

Please sign in to comment.