diff --git a/CHANGES.md b/CHANGES.md index ccaf8dbf..b41d3700 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +**Removed:** + +- Remove hints about possibly not needing `babel.cherryPick` due to Webpack 2 tree shaking, as this doesn't currently appear to be true. + # 0.15.0 / 2017-01-25 **Breaking Changes:** diff --git a/docs/Configuration.md b/docs/Configuration.md index 69a18db6..eed55e0b 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -130,10 +130,6 @@ module.exports = { ##### `cherryPick`: `String | Array` -> As of v0.15 nwb uses Webpack 2, which can tree shake ES modules (to a degree) to avoid including unused imports in the bundles it creates. If a module you're importing has a `"module"` entry in its `package.json` which points to a build using ES modules, you might not need to use `cherryPick`. -> -> Running `nwb check-config` will tell you if any modules you've configured `cherryPick` for might be suitable for Webpack 2 to handle instead. - **Note:** this feature only works if you're using ES6 `import` syntax. Module names to apply `import` cherry-picking to. diff --git a/src/getUserConfig.js b/src/getUserConfig.js index 986589a1..d72e8332 100644 --- a/src/getUserConfig.js +++ b/src/getUserConfig.js @@ -4,14 +4,13 @@ import util from 'util' import chalk from 'chalk' import figures from 'figures' import glob from 'glob' -import resolve from 'resolve' import webpack from 'webpack' import {CONFIG_FILE_NAME, PROJECT_TYPES} from './constants' import {COMPAT_CONFIGS} from './createWebpackConfig' import debug from './debug' import {ConfigValidationError} from './errors' -import {deepToString, joinAnd, typeOf} from './utils' +import {deepToString, typeOf} from './utils' const DEFAULT_REQUIRED = false @@ -196,32 +195,6 @@ export function processUserConfig({ } } - if ('cherryPick' in userConfig.babel) { - let {cherryPick} = userConfig.babel - if (typeOf(cherryPick) === 'string') { - cherryPick = [cherryPick] - } - let esModules = [] - cherryPick.forEach(mod => { - try { - let pkg = require(resolve.sync(`${mod}/package.json`, {basedir: process.cwd()})) - if (pkg.module) { - esModules.push(mod) - } - } - catch (e) { - // pass - } - }) - if (esModules.length > 0) { - let n = esModules.length - report.hint('babel.cherryPick', - `${joinAnd(esModules)} ${s(n, 'has,have')} a ${chalk.cyan('"module"')} entry in ${s(n, 'its,their')} ${chalk.cyan('package.json')}.`, - `If you're using ES modules, You Might Not Need ${chalk.green('babel.cherryPick')} for ${s(n, 'this,these')} module${s(n)}, as Webpack 2 can tree shake ES modules.`, - ) - } - } - // Karma config // TODO Remove in a future version if (userConfig.karma.testDir || userConfig.karma.testDirs) {