How to reduce upward import with core-js?

109 Views Asked by At

I need to do import from a file that is in an another directive, so I go "up" with import from '../../../Controls/example' I know that it can be reduced with core-js to something like import from 'Controls/example', but I can't get how.

1

There are 1 best solutions below

5
On BEST ANSWER

Do you mean give a short alias name of local files? You can add resolve.alias config in webpack.config.js

const path = require('path');

module.exports = {
  //...
  resolve: {
    alias: {
      Controls: path.resolve(__dirname, '../../../Controls/')
    }
  }
};

https://webpack.js.org/configuration/resolve/#resolvealias