# Recipes

# Optimize your command

  • Edit /path/to/project/package.json:
{
  // ...
  "scripts": {
    "dev": "gulp",
    "prod": "gulp --production"
  }
  // ...
}
  • For silent mode
{
  // ...
  "scripts": {
    "dev": "gulp --silent",
    "prod": "gulp --silent --production"
  }
  // ...
}

gulp --production alias: gulp -p

gulp --silent alias: gulp -S

Then, you can run the command like this:

  • For development
yarn run dev
# OR
npm run dev
  • For production
yarn run prod
# OR
npm run prod

# IE compatibility

# 1. Install the dependency used to provide the necessary runtime helpers

yarn add core-js @babel/runtime-corejs3
# OR
npm i --save core-js @babel/runtime-corejs3

# 2. Upgrade .browserslistrc

ie 8 # add it

# 3. Config babel.config.js

module.exports = {
  presets: [
    [
      '@babel/preset-env',
      {
        modules: 'commonjs',
        useBuiltIns: 'entry',
        corejs: 3
      }
    ]
  ],
  plugins: [['@babel/plugin-transform-runtime', { corejs: 3 }]]
};

# 4. Config balm

balm.config = {
  scripts: {
    ie8: true
  }
};

# 5. Upgrade entry js file

  • main.js
import './polyfill';

// Your code
  • polyfill.js
// For IE11 and below
import 'core-js/features/promise';

// For IE8 and below
import 'core-js/features/object/create';
import 'core-js/features/array/for-each';
import 'core-js/features/function/bind';
Last Updated: a few seconds ago