diff --git a/index.js b/index.js index 7fe36024..10b65bc7 100644 --- a/index.js +++ b/index.js @@ -1,32 +1,30 @@ const path = require("path"); const dirPath = path.join(__dirname); -if (process.env.NODE_ENV !== "production") { - require("@babel/register")({ - presets: [ - [require.resolve("@babel/preset-env")], - [ - require.resolve("next/babel"), - { - "preset-env": {}, - "transform-runtime": {}, - "styled-jsx": {}, - "class-properties": {}, - }, - ], +require("@babel/register")({ + presets: [ + [require.resolve("@babel/preset-env")], + [ + require.resolve("next/babel"), + { + "preset-env": {}, + "transform-runtime": {}, + "styled-jsx": {}, + "class-properties": {}, + }, ], - plugins: [ - [ - require.resolve("babel-plugin-module-resolver"), - { - alias: { - "~": dirPath, - }, + ], + plugins: [ + [ + require.resolve("babel-plugin-module-resolver"), + { + alias: { + "~": dirPath, }, - ], + }, ], - ignore: ["node_modules", ".next"], - }); -} + ], + ignore: ["node_modules", ".next"], +}); module.exports = require("./server.js"); diff --git a/package-lock.json b/package-lock.json index ffd70160..e00a10f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { + "@babel/core": "^7.15.0", + "@babel/register": "^7.15.3", "@emotion/babel-preset-css-prop": "11.2.0", "@emotion/react": "11.1.5", "@glif/filecoin-number": "^1.1.0-beta.17", @@ -63,11 +65,9 @@ "ws": "^7.4.3" }, "devDependencies": { - "@babel/core": "^7.15.0", "@babel/eslint-parser": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.12.16", "@babel/preset-env": "^7.12.16", - "@babel/register": "^7.15.3", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-json": "^4.1.0", @@ -1867,7 +1867,6 @@ "version": "7.15.3", "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.15.3.tgz", "integrity": "sha512-mj4IY1ZJkorClxKTImccn4T81+UKTo4Ux0+OFSV9hME1ooqS9UV+pJ6BjD0qXPK4T3XW/KNa79XByjeEMZz+fw==", - "dev": true, "dependencies": { "clone-deep": "^4.0.1", "find-cache-dir": "^2.0.0", @@ -4492,7 +4491,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dev": true, "dependencies": { "is-plain-object": "^2.0.4", "kind-of": "^6.0.2", @@ -7381,7 +7379,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, "dependencies": { "isobject": "^3.0.1" }, @@ -7393,7 +7390,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -7745,7 +7741,6 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -9689,7 +9684,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -10280,7 +10274,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", - "dev": true, "dependencies": { "node-modules-regexp": "^1.0.0" }, @@ -11406,7 +11399,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dev": true, "dependencies": { "kind-of": "^6.0.2" }, @@ -14966,7 +14958,6 @@ "version": "7.15.3", "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.15.3.tgz", "integrity": "sha512-mj4IY1ZJkorClxKTImccn4T81+UKTo4Ux0+OFSV9hME1ooqS9UV+pJ6BjD0qXPK4T3XW/KNa79XByjeEMZz+fw==", - "dev": true, "requires": { "clone-deep": "^4.0.1", "find-cache-dir": "^2.0.0", @@ -17185,7 +17176,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dev": true, "requires": { "is-plain-object": "^2.0.4", "kind-of": "^6.0.2", @@ -19417,7 +19407,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, "requires": { "isobject": "^3.0.1" }, @@ -19425,8 +19414,7 @@ "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" } } }, @@ -19700,8 +19688,7 @@ "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" }, "knex": { "version": "0.95.4", @@ -21231,8 +21218,7 @@ "node-modules-regexp": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true + "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=" }, "node-releases": { "version": "1.1.71", @@ -21661,7 +21647,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", - "dev": true, "requires": { "node-modules-regexp": "^1.0.0" } @@ -22552,7 +22537,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dev": true, "requires": { "kind-of": "^6.0.2" } diff --git a/package.json b/package.json index d4fab986..3273d886 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,8 @@ }, "repository": "filecoin-project/slate", "dependencies": { + "@babel/core": "^7.15.0", + "@babel/register": "^7.15.3", "@emotion/babel-preset-css-prop": "11.2.0", "@emotion/react": "11.1.5", "@glif/filecoin-number": "^1.1.0-beta.17", @@ -87,11 +89,9 @@ "ws": "^7.4.3" }, "devDependencies": { - "@babel/core": "^7.15.0", "@babel/eslint-parser": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.12.16", "@babel/preset-env": "^7.12.16", - "@babel/register": "^7.15.3", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-json": "^4.1.0", diff --git a/scripts/index.js b/scripts/index.js index 315fb493..964714a9 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,10 +1,10 @@ if (process.env.NODE_ENV !== "production") { require("dotenv").config(); - - require("@babel/register")({ - presets: ["@babel/preset-env"], - ignore: ["node_modules", ".next"], - }); } +require("@babel/register")({ + presets: ["@babel/preset-env"], + ignore: ["node_modules", ".next"], +}); + module.exports = require("./" + process.argv[2] + ".js");