Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Where we can add aliases for certain modules #5433


User avatar
0
velu created

Hi,

We want to add aliases for certain modules.

and we don't have a webpack.config.js how can we achieve this in angular.

Please help me to solve this.

Eg;

module.exports = {
  "resolve": {
    ...
    "alias": {
      globalize$: path.resolve(__dirname, "node_modules/globalize/dist/globalize.js"),
      globalize: path.resolve(__dirname, "node_modules/globalize/dist/globalize"),
      cldr$: path.resolve(__dirname, "node_modules/cldrjs/dist/cldr.js"),
      cldr: path.resolve(__dirname, "node_modules/cldrjs/dist/cldr"),
      ...
    },
 },

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @velu,

    I don't know if angular-cli supports it or not. You can check it on angular-cli's repository <a class="postlink" href="https://github.com/angular/angular-cli/issues/">https://github.com/angular/angular-cli/issues/</a>.

  • User Avatar
    0
    velu created

    instead of webpack.config.js

    Add following code in tsconfig.json

    "paths": {
          "globalize": [
            "node_modules/globalize/dist/globalize"
          ],
          "globalize/*": [
            "node_modules/globalize/dist/globalize/*"
          ],
          "cldr": [
            "node_modules/cldrjs/dist/cldr"
          ],
          "cldr/*": [
            "node_modules/cldrjs/dist/cldr/*"
          ]
        }
    

    its work for me in angular 6.0