Friday, 8 November 2019

How to change webpack module export require string?

When creating bundle with webpack, for example, it outputs angular as follows.

/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js");

But i want output is like this;

/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "@angular/core");

it says on the internet that you need to change resolve.alias, but what i understand is that if i change resolve.alias, this time i can't find the path of the module I use.

I'm not very dominated by the webpack, but I'm sure there is a solution to this problem. Is there any solution available?

const path = require('path');

module.exports = {
    resolve: {
        alias: {
          //I'm stuck there
        }
    }
};


from How to change webpack module export require string?

No comments:

Post a Comment