From af6ff032aca0fbbc6fec5b4d4c38527756836445 Mon Sep 17 00:00:00 2001 From: Mike Cooper Date: Wed, 23 Jan 2019 13:28:40 -0800 Subject: [PATCH] Make "yarn build" work with "yarn install --prod" --- config/webpack.config.base.js | 17 -------- config/webpack.config.dev.js | 21 +++++++++ package.json | 82 +++++++++++++++++------------------ 3 files changed, 62 insertions(+), 58 deletions(-) diff --git a/config/webpack.config.base.js b/config/webpack.config.base.js index 05401d31a..d9c4e7ac9 100644 --- a/config/webpack.config.base.js +++ b/config/webpack.config.base.js @@ -1,5 +1,4 @@ const autoprefixer = require('autoprefixer'); -const eslintFormatter = require('react-dev-utils/eslintFormatter'); const ExtractCssChunksPlugin = require('extract-css-chunks-webpack-plugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const path = require('path'); @@ -46,22 +45,6 @@ module.exports = { module: { strictExportPresence: true, rules: [ - // First, run the linter. - // It's important to do this before Babel processes the JS. - { - test: /\.(js|jsx|mjs)$/, - enforce: 'pre', - use: [ - { - options: { - formatter: eslintFormatter, - eslintPath: require.resolve('eslint'), - }, - loader: require.resolve('eslint-loader'), - }, - ], - include: paths.appSrc, - }, { // "oneOf" will traverse all following loaders until one will // match the requirements. When no loader matches it will fall diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 596590f61..73d306685 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -8,6 +8,7 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM const baseConfig = require('./webpack.config.base'); const getClientEnvironment = require('./env'); const paths = require('./paths'); +const eslintFormatter = require('react-dev-utils/eslintFormatter'); // Webpack uses `publicPath` to determine where the app is being served from. // In development, we always serve from the root. This makes config easier. @@ -50,6 +51,26 @@ const config = { // initialization, it doesn't blow up the WebpackDevServer client, and // changing JS code would still trigger a refresh. ], + module: { + rules: [ + // First, run the linter. + // It's important to do this before Babel processes the JS. + { + test: /\.(js|jsx|mjs)$/, + enforce: 'pre', + use: [ + { + options: { + formatter: eslintFormatter, + eslintPath: require.resolve('eslint'), + }, + loader: require.resolve('eslint-loader'), + }, + ], + include: paths.appSrc, + }, + ], + }, output: { // Add /* filename */ comments to generated require()s in the output. pathinfo: true, diff --git a/package.json b/package.json index 0cc1f3032..b7068c26b 100644 --- a/package.json +++ b/package.json @@ -7,18 +7,51 @@ "type": "git", "url": "https://github.com/mozilla/delivery-console" }, + "scripts": { + "start": "node scripts/start.js", + "build": "node scripts/build.js", + "test": "node scripts/test.js test --env=jsdom", + "test:ci": "CI=true yarn test --runInBand", + "test:watch": "yarn test --watch", + "lint": "therapist use lint:all", + "lint:fix": "therapist use fix:all" + }, "dependencies": { + "@babel/core": "7.2.2", + "@babel/plugin-proposal-decorators": "7.3.0", + "@babel/polyfill": "7.2.5", + "@babel/runtime": "7.3.1", "antd": "3.12.4", "auth0-js": "9.9.1", "autobind-decorator": "2.4.0", + "autoprefixer": "9.4.6", + "babel-core": "7.0.0-bridge.0", + "babel-loader": "8.0.5", + "babel-plugin-import": "1.11.0", + "babel-preset-react-app": "7.0.0", + "case-sensitive-paths-webpack-plugin": "2.1.2", "chalk": "2.4.2", "connected-react-router": "5.0.1", + "css-loader": "2.1.0", + "cssnano": "4.1.8", "date-fns": "1.30.1", + "extract-css-chunks-webpack-plugin": "3.3.2", + "file-loader": "3.0.1", + "fs-extra": "7.0.1", + "generate-json-webpack-plugin": "0.3.1", + "html-webpack-plugin": "4.0.0-beta.5", "immutable": "3.8.2", + "less": "3.9.0", + "less-loader": "4.1.0", "lodash": "4.17.11", + "object-assign": "4.1.1", + "postcss-flexbugs-fixes": "4.1.0", + "postcss-loader": "3.0.0", + "promise": "8.0.2", "raven-js": "3.27.0", "react": "16.7.0", "react-copy-to-clipboard": "5.0.1", + "react-dev-utils": "7.0.1", "react-dom": "16.7.0", "react-redux": "5.1.1", "react-router": "4.3.1", @@ -27,32 +60,18 @@ "redux": "4.0.1", "redux-immutable": "4.0.0", "redux-logger": "3.0.6", - "redux-thunk": "2.3.0" - }, - "scripts": { - "start": "node scripts/start.js", - "build": "node scripts/build.js", - "test": "node scripts/test.js test --env=jsdom", - "test:ci": "CI=true yarn test --runInBand", - "test:watch": "yarn test --watch", - "lint": "therapist use lint:all", - "lint:fix": "therapist use fix:all" + "redux-thunk": "2.3.0", + "style-loader": "0.23.1", + "sw-precache-webpack-plugin": "0.11.5", + "uglifyjs-webpack-plugin": "2.1.1", + "url-loader": "1.1.2", + "webpack": "4.29.0", + "webpack-manifest-plugin": "2.0.4", + "webpack-merge": "4.2.1" }, "devDependencies": { - "@babel/core": "7.2.2", - "@babel/plugin-proposal-decorators": "7.3.0", - "@babel/polyfill": "7.2.5", - "@babel/runtime": "7.3.1", - "autoprefixer": "9.4.6", - "babel-core": "7.0.0-bridge.0", "babel-eslint": "10.0.1", "babel-jest": "23.6.0", - "babel-loader": "8.0.5", - "babel-plugin-import": "1.11.0", - "babel-preset-react-app": "7.0.0", - "case-sensitive-paths-webpack-plugin": "2.1.2", - "css-loader": "2.1.0", - "cssnano": "4.1.8", "dotenv": "6.2.0", "dotenv-expand": "4.2.0", "enzyme": "3.8.0", @@ -66,37 +85,18 @@ "eslint-plugin-jsx-a11y": "6.1.2", "eslint-plugin-prettier": "3.0.1", "eslint-plugin-react": "7.12.4", - "extract-css-chunks-webpack-plugin": "3.3.2", "faker": "4.1.0", "fetch-mock": "7.3.0", - "file-loader": "3.0.1", - "fs-extra": "7.0.1", - "generate-json-webpack-plugin": "0.3.1", - "html-webpack-plugin": "4.0.0-beta.5", "jest": "23.6.0", "jest-immutable-matchers": "2.0.1", - "less": "3.9.0", - "less-loader": "4.1.0", - "object-assign": "4.1.1", - "postcss-flexbugs-fixes": "4.1.0", - "postcss-loader": "3.0.0", "prettier": "1.16.1", - "promise": "8.0.2", "raf": "3.4.1", - "react-dev-utils": "7.0.1", "react-testing-library": "5.4.4", "resolve": "1.10.0", - "style-loader": "0.23.1", "stylelint": "9.10.1", "stylelint-config-standard": "18.2.0", "stylelint-order": "2.0.0", - "sw-precache-webpack-plugin": "0.11.5", - "uglifyjs-webpack-plugin": "2.1.1", - "url-loader": "1.1.2", - "webpack": "4.29.0", "webpack-dev-server": "3.1.14", - "webpack-manifest-plugin": "2.0.4", - "webpack-merge": "4.2.1", "whatwg-fetch": "3.0.0" }, "jest": {