Question · JavaScript and React course · Module 9: Modern React Hooks

Import Impact on Bundle Size

Which import lets the bundler remove a library's unused code from the bundle (tree shaking)?

Answer options

  • const _ = require('lodash')
  • import _ from 'lodash'
  • import { debounce } from 'lodash-es'
  • const { debounce } = require('lodash')

You can check the correct answer by solving this task in the CodeWorlds game.