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
}
}
};
UPDATE
This problem occurs exactly in the following scenario, for example the C module uses the X library. At the same time, this C module is opened under the A module, the child of the A module. Modules A and C are compiled on 2 different projects. I bundle the X library inside module A. I don't bundle the X module inside the C module. Because I know that in module A, this module X is bundled. However, the C module developer gets the X Module reference from the "D: \ X-Library" file path, while the A module developer gets the X Module reference from the "D: \ Libraries \ X-Library" file path. And with these references, Webpack calls the X module from within the bundle. Finally, when the C module is opened inside the A module, when it wants to use the X module, it requests "D: \ X-Library" as _webpack_require ("D: \ X-Library"). However, the module X is registered by module A as _webpack_require ("D: \ Librarires \ X-Library"). That's why it doesn't work. I hope I can, the child of the A module. Modules A and C are compiled on 2 different projects. I bundle the X library inside module A. I don't bundle the X module inside the C module. Because I know that in module A, this module X is bundled. However, the C module developer gets the X Module reference from the "D: \ X-Library" file path, while the A module developer gets the X Module reference from the "D: \ Libraries \ X-Library" file path. And with these references, Webpack calls the X module from within the bundle. Finally, when the C module is opened inside the A module, when it wants to use the X module, it requests "D: \ X-Library" as _webpack_require ("D: \ X-Library"). However, the module X is registered by module A as _webpack_require ("D: \ Librarires \ X-Library"). That's why it doesn't work. I hope I can.