From 7ce458fe2d414caa74841b0072a8d69a322053d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Thu, 23 Feb 2017 17:24:18 +0000 Subject: [PATCH] fix production "Unexpected token" error --- frontend/.babelrc | 2 +- frontend/webpack/base.js | 21 +++++---------------- frontend/webpack/development.js | 27 ++++++++++++++++++++++++--- ui/yarn.lock | 8 ++++---- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/frontend/.babelrc b/frontend/.babelrc index 0a1ffbe7..79177d83 100644 --- a/frontend/.babelrc +++ b/frontend/.babelrc @@ -44,7 +44,7 @@ }, "production": { "plugins": [ - "transform-react-constant-elements" + // "transform-react-constant-elements" enable when #5325 is fixed ] } } diff --git a/frontend/webpack/base.js b/frontend/webpack/base.js index 86f37fd6..d6931d79 100644 --- a/frontend/webpack/base.js +++ b/frontend/webpack/base.js @@ -9,8 +9,7 @@ const { MODULES, FRONTEND, UI, - STATIC, - ESLINT + STATIC } = paths; module.exports = { @@ -39,23 +38,13 @@ module.exports = { }, plugins: [ plugins['define'](), - plugins['shell']() + plugins['shell'](), + plugins['named-modules'](), + plugins['case-sensitive-paths']() + ], module: { rules: [{ - test: /js?$/, - enforce: 'pre', - use: [{ - loader: 'eslint-loader', - options: { - configFile: ESLINT - } - }], - include: [ - FRONTEND, - UI - ] - }, { exclude: [ /\.html$/, /\.(js|jsx)$/, diff --git a/frontend/webpack/development.js b/frontend/webpack/development.js index 9dae8fad..cb4799bd 100644 --- a/frontend/webpack/development.js +++ b/frontend/webpack/development.js @@ -1,6 +1,13 @@ // const graphql = require('../../cloudapi-graphql/src/endpoint'); const plugins = require('./plugins'); const base = require('./base'); +const paths = require('./paths'); + +const { + FRONTEND, + UI, + ESLINT +} = paths; const devServer = { hot: true, @@ -26,11 +33,25 @@ module.exports = Object.assign(base, { 'react-dev-utils/webpackHotDevClient', base.entry ], + module: { + rules: base.module.rules.concat([{ + test: /js?$/, + enforce: 'pre', + use: [{ + loader: 'eslint-loader', + options: { + configFile: ESLINT + } + }], + include: [ + FRONTEND, + UI + ] + }]) + }, plugins: base.plugins.concat([ - plugins['named-modules'](), plugins['hot-module-replacement'](), - plugins['watch-missing-node-modules'](), - plugins['case-sensitive-paths']() + plugins['watch-missing-node-modules']() ]), node: { fs: 'empty', diff --git a/ui/yarn.lock b/ui/yarn.lock index ce464dcd..6476209f 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -1332,8 +1332,8 @@ babel-types@^6.15.0, babel-types@^6.16.0, babel-types@^6.18.0, babel-types@^6.19 to-fast-properties "^1.0.1" babylon@^6.1.0, babylon@^6.10.0, babylon@^6.11.0, babylon@^6.12.0, babylon@^6.13.0, babylon@^6.15.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" + version "6.16.1" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" babylon@~5.8.3: version "5.8.38" @@ -1543,8 +1543,8 @@ caniuse-api@^1.5.2: lodash.uniq "^4.3.0" caniuse-db@^1.0.30000187, caniuse-db@^1.0.30000346, caniuse-db@^1.0.30000624: - version "1.0.30000624" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000624.tgz#554b87547895e36f5fe128f4b7448a2ea5bf2213" + version "1.0.30000626" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000626.tgz#44363dc86857efaf758fea9faef6a15ed93d8f33" capture-stack-trace@^1.0.0: version "1.0.0"