mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-22 12:24:02 +03:00
only require babel register on dev
This commit is contained in:
parent
dae49fd767
commit
f7bdea0d4a
48
index.js
48
index.js
@ -1,30 +1,32 @@
|
||||
const path = require("path");
|
||||
const dirPath = path.join(__dirname);
|
||||
|
||||
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,
|
||||
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": {},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
ignore: ["node_modules", ".next"],
|
||||
});
|
||||
plugins: [
|
||||
[
|
||||
require.resolve("babel-plugin-module-resolver"),
|
||||
{
|
||||
alias: {
|
||||
"~": dirPath,
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
ignore: ["node_modules", ".next"],
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = require("./server.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");
|
||||
|
Loading…
Reference in New Issue
Block a user