Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Webpack tree shaking #352

Merged
merged 8 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"presets": [
[ "next/babel", {
"preset-env": {
"modules": "commonjs",
"targets": {
"node": "current",
"browsers": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"mdi-material-ui": "^5.4.0",
"mobx": "^4.1.1",
"mobx-react": "^5.0.0",
"next": "^7.0.0",
"next": "^7.0.1",
"next-routes": "^1.4.2",
"passport": "^0.4.0",
"passport-oauth2": "^1.4.0",
Expand Down
7 changes: 5 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const dev = process.env.NODE_ENV !== "production";
export const appPath = process.env.NODE_ENV === "production" ? "./build/app" : "./src";
module.exports = {
dev: process.env.NODE_ENV !== "production",
appPath: process.env.NODE_ENV === "production" ? "./build/app" : "./src"
};

8 changes: 4 additions & 4 deletions src/lib/logger/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-console */
import chalk from "chalk";
const chalk = require("chalk");

/**
* Logger middleware
Expand All @@ -15,10 +15,10 @@ const logger = {
console.log(`Server started ! ${chalk.green("✓")}`);

console.log(`
${chalk.magenta(`http://${host}:${port}`)}
${chalk.blue(`Press ${chalk.italic("CTRL-C")} to stop`)}
${chalk.magenta(`http://${host}:${port}`)}
${chalk.blue(`Press ${chalk.italic("CTRL-C")} to stop`)}
`);
}
};

export default logger;
module.exports = logger;
7 changes: 0 additions & 7 deletions src/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import flush from "styled-jsx/server";
import Helmet from "react-helmet";
import analyticsProviders from "analytics";
import { ServerStyleSheet } from "styled-components";
// import getConfig from "next/config";
import favicons from "../lib/utils/favicons";

/**
Expand Down Expand Up @@ -58,8 +57,6 @@ class HTMLDocument extends Document {
render() {
const { helmet, pageContext, styledComponentsStyleTags } = this.props;
const htmlAttrs = helmet.htmlAttributes.toComponent();
// const { publicRuntimeConfig } = getConfig();
// const { keycloakConfig } = publicRuntimeConfig;
const links = [
{ rel: "canonical", href: process.env.CANONICAL_URL },
{ rel: "stylesheet", href: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,700" },
Expand All @@ -85,10 +82,6 @@ class HTMLDocument extends Document {
type: "text/javascript",
innerHTML: provider.renderScript()
})),
// {
// type: "text/javascript",
// src: `${keycloakConfig.url}/js/keycloak.js`
// },
{
type: "text/javascript",
src: "https://js.stripe.com/v3/"
Expand Down
26 changes: 13 additions & 13 deletions src/server.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import cookieParser from "cookie-parser";
import express from "express";
import cookieSession from "cookie-session";
import nextApp from "next";
import request from "request";
import { useStaticRendering } from "mobx-react";
import logger from "lib/logger";
import passport from "passport";
import OAuth2Strategy from "passport-oauth2";
import refresh from "passport-oauth2-refresh";
import { appPath, dev } from "./config";
import router from "./routes";
const cookieParser = require("cookie-parser");
const express = require("express");
const session = require("express-session");
const nextApp = require("next");
const request = require("request");
const { useStaticRendering } = require("mobx-react");
const logger = require("lib/logger");
const passport = require("passport");
const OAuth2Strategy = require("passport-oauth2");
const refresh = require("passport-oauth2-refresh");
const { appPath, dev } = require("./config");
const router = require("./routes");

const app = nextApp({ dir: appPath, dev });
const routeHandler = router.getRequestHandler(app);
Expand Down Expand Up @@ -116,4 +116,4 @@ app
process.exit(1);
});

export default app;
module.exports = app;
Loading