Updated next config to not need node-sass in production

This commit is contained in:
JJ Kasper
2018-06-02 14:22:34 -05:00
parent 2929827618
commit e72fd02514
19 changed files with 56 additions and 47 deletions

View File

@@ -1 +1 @@
cb6646c6-7dcf-467d-88f4-5045f74272e2 60371e5c-2085-4a2b-a88a-b930f4568bf0

View File

@@ -1 +1 @@
{"pages":{},"css":["static/style.css"],"chunks/react_markdown_2310f29285bb72f338f5fec99785c0fb":["chunks/react_markdown_2310f29285bb72f338f5fec99785c0fb-479a128a833f73d68323.js"],"chunks/comps_CodeMirror_51c113b8f0eb112cf9be60e9d3293726":["chunks/comps_CodeMirror_51c113b8f0eb112cf9be60e9d3293726-581c2db5cdb3d1a4e360.js"],"bundles/pages/_error.js":["bundles/pages/_error.js"],"bundles/pages/edit.js":["bundles/pages/edit.js"],"bundles/pages/new.js":["bundles/pages/new.js"],"bundles/pages/index.js":["bundles/pages/index.js"],"bundles/pages/k.js":["bundles/pages/k.js"],"bundles/pages/_app.js":["bundles/pages/_app.js"],"bundles/pages/settings.js":["bundles/pages/settings.js"],"main.js":["static/commons/main-a8c05964db3925fe00b3.js"]} {"pages":{},"css":["static/style.css"],"chunks/react_markdown_2310f29285bb72f338f5fec99785c0fb":["chunks/react_markdown_2310f29285bb72f338f5fec99785c0fb-24ac0d0da9f40eb7d170.js"],"chunks/comps_CodeMirror_51c113b8f0eb112cf9be60e9d3293726":["chunks/comps_CodeMirror_51c113b8f0eb112cf9be60e9d3293726-eb3ede167b1ed71779ab.js"],"bundles/pages/_error.js":["bundles/pages/_error.js"],"bundles/pages/edit.js":["bundles/pages/edit.js"],"bundles/pages/new.js":["bundles/pages/new.js"],"bundles/pages/_app.js":["bundles/pages/_app.js"],"bundles/pages/index.js":["bundles/pages/index.js"],"bundles/pages/k.js":["bundles/pages/k.js"],"bundles/pages/settings.js":["bundles/pages/settings.js"],"main.js":["static/commons/main-d7fba9ff49dfbe2862b8.js"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -433,8 +433,6 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_redux__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_redux__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_redux___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react_redux__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_redux___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react_redux__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__redux_actions_userAct__ = __webpack_require__(2); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__redux_actions_userAct__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__styles_style_sass__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__styles_style_sass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__styles_style_sass__);
@@ -461,7 +459,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
// Don't load sass during ssr
if (!global.kbConf) {
__webpack_require__(31);
}
var ssr = typeof window === 'undefined'; var ssr = typeof window === 'undefined';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +1,26 @@
const withSass = require('@zeit/next-sass') const { ANALYZE, BUILD, NODE_ENV } = process.env
const { ANALYZE } = process.env let conf = {
let AnalyzerPlugin poweredByHeader: false,
}
if (ANALYZE) { if (ANALYZE) {
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
AnalyzerPlugin = BundleAnalyzerPlugin conf.webpack = function(config, { isServer }) {
} config.plugins.push(
module.exports = withSass({ new BundleAnalyzerPlugin({
poweredByHeader: false, analyzerMode: 'server',
webpack: function(config, { isServer }) { analyzerPort: isServer ? 8888 : 8889,
if (ANALYZE) { openAnalyzer: true,
config.plugins.push( })
new AnalyzerPlugin({ )
analyzerMode: 'server',
analyzerPort: isServer ? 8888 : 8889,
openAnalyzer: true,
})
)
}
return config return config
}, }
}) }
// Only add sass module when building or during dev
if (BUILD || NODE_ENV !== 'production') {
const withSass = require('@zeit/next-sass')
conf = withSass(conf)
}
module.exports = conf

View File

@@ -27,7 +27,7 @@
"format": "prettier --ignore-path .eslintignore --write '**/*.js'", "format": "prettier --ignore-path .eslintignore --write '**/*.js'",
"lint": "eslint . --config .eslintrc.json", "lint": "eslint . --config .eslintrc.json",
"mocha": "cross-env NODE_ENV=production mocha test/ --recursive --exit", "mocha": "cross-env NODE_ENV=production mocha test/ --recursive --exit",
"build": "next build", "build": "cross-env BUILD=true next build",
"analyze": "cross-env ANALYZE=true next build", "analyze": "cross-env ANALYZE=true next build",
"dev": "nodemon -w ./src -w ./config -w ./util -w next.config.js --exec 'npm run start:dev'", "dev": "nodemon -w ./src -w ./config -w ./util -w next.config.js --exec 'npm run start:dev'",
"start:dev": "node src/", "start:dev": "node src/",
@@ -43,7 +43,6 @@
"@feathersjs/errors": "^3.3.0", "@feathersjs/errors": "^3.3.0",
"@feathersjs/express": "^1.2.2", "@feathersjs/express": "^1.2.2",
"@feathersjs/feathers": "^3.1.4", "@feathersjs/feathers": "^3.1.4",
"@zeit/next-sass": "^0.1.2",
"chokidar": "^2.0.3", "chokidar": "^2.0.3",
"codemirror": "^5.37.0", "codemirror": "^5.37.0",
"compression": "^1.7.2", "compression": "^1.7.2",
@@ -60,7 +59,6 @@
"milligram": "^1.3.0", "milligram": "^1.3.0",
"nedb": "^1.8.0", "nedb": "^1.8.0",
"next": "^6.0.0", "next": "^6.0.0",
"node-sass": "^4.8.3",
"react": "^16.3.2", "react": "^16.3.2",
"react-dom": "^16.3.2", "react-dom": "^16.3.2",
"react-markdown": "^3.3.0", "react-markdown": "^3.3.0",
@@ -73,10 +71,12 @@
"winston": "^2.4.1" "winston": "^2.4.1"
}, },
"devDependencies": { "devDependencies": {
"@zeit/next-sass": "^0.2.0",
"babel-eslint": "^8.2.3", "babel-eslint": "^8.2.3",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"eslint-plugin-react": "^7.8.2", "eslint-plugin-react": "^7.8.2",
"mocha": "^5.1.1", "mocha": "^5.1.1",
"node-sass": "^4.9.0",
"nodemon": "^1.17.3", "nodemon": "^1.17.3",
"prettier": "^1.13.4", "prettier": "^1.13.4",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",

View File

@@ -2,7 +2,10 @@ import App, { Container } from 'next/app'
import store from '../redux/store' import store from '../redux/store'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { setUser, doLogin } from '../redux/actions/userAct' import { setUser, doLogin } from '../redux/actions/userAct'
import '../styles/style.sass' // Don't load sass during ssr
if (!global.kbConf) {
require('../styles/style.sass')
}
const ssr = typeof window === 'undefined' const ssr = typeof window === 'undefined'
export default class MyApp extends App { export default class MyApp extends App {

View File

@@ -744,9 +744,9 @@
lodash "^4.17.4" lodash "^4.17.4"
url-pattern "^1.0.3" url-pattern "^1.0.3"
"@zeit/next-css@0.1.5": "@zeit/next-css@0.2.0":
version "0.1.5" version "0.2.0"
resolved "https://registry.yarnpkg.com/@zeit/next-css/-/next-css-0.1.5.tgz#e306a0ea7b0f49935632c3b154232d6a8b96f982" resolved "https://registry.yarnpkg.com/@zeit/next-css/-/next-css-0.2.0.tgz#35da071256397b509b86ac7726ce0f7d3593e62b"
dependencies: dependencies:
css-loader "0.28.9" css-loader "0.28.9"
extract-text-webpack-plugin "3.0.2" extract-text-webpack-plugin "3.0.2"
@@ -755,11 +755,11 @@
ignore-loader "0.1.2" ignore-loader "0.1.2"
postcss-loader "2.0.10" postcss-loader "2.0.10"
"@zeit/next-sass@^0.1.2": "@zeit/next-sass@^0.2.0":
version "0.1.2" version "0.2.0"
resolved "https://registry.yarnpkg.com/@zeit/next-sass/-/next-sass-0.1.2.tgz#cc46cc1d76b64d599edf662356e38520346968bc" resolved "https://registry.yarnpkg.com/@zeit/next-sass/-/next-sass-0.2.0.tgz#dc860dbbab45b5fa010168c3a44a29cf8aa39db5"
dependencies: dependencies:
"@zeit/next-css" "0.1.5" "@zeit/next-css" "0.2.0"
extract-text-webpack-plugin "3.0.2" extract-text-webpack-plugin "3.0.2"
sass-loader "6.0.6" sass-loader "6.0.6"
@@ -4723,9 +4723,9 @@ node-pre-gyp@^0.6.39:
tar "^2.2.1" tar "^2.2.1"
tar-pack "^3.4.0" tar-pack "^3.4.0"
node-sass@^4.8.3: node-sass@^4.9.0:
version "4.8.3" version "4.9.0"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.8.3.tgz#d077cc20a08ac06f661ca44fb6f19cd2ed41debb" resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.9.0.tgz#d1b8aa855d98ed684d6848db929a20771cc2ae52"
dependencies: dependencies:
async-foreach "^0.1.3" async-foreach "^0.1.3"
chalk "^1.1.1" chalk "^1.1.1"