Skip to content

default imports from lib

Pawel Przezwanski edited this page Jan 27, 2020 · 1 revision

louv exposes for developer its library built of treeshakable es6 modules. However treeshaking happens usually on production builds. To speed up development builds it is worth considering importing morphs and scenarios from lib folder:

  • node_modules/louv/lib/morphs
  • node_modules/louv/lib/scenarios

However usually node_modules are exclude in build tools compilers such as babel. We have to prevent excluding louv among other node_modules in such configurations.

So in webpack it will be:

{
  test: /\.js?$/,
  // exclude: /node_modules/,
  exclude: /node_modules(?!(\/|\\)louv)/,
    use: {
      loader: 'babel-loader',
      options: { presets: ['@babel/preset-env'] },
    },
  },

while in browserify / babelify inside of gulp config we have to add 'global: true' and 'ignore':

.transform('babelify', {
    ignore: [/node_modules(?!(\/|\\)louv)/],
    global: true,
    presets: ['@babel/preset-env']
  })
Clone this wiki locally