Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

"Argument 'module' is not a function, got Object" when inject module dependencies #115

Open
fp-Kuba opened this issue Feb 28, 2018 · 0 comments

Comments

@fp-Kuba
Copy link

fp-Kuba commented Feb 28, 2018

I'm using webpack and ES6 module in angular 1.x app. In webpack.config I set:

resolve: {
    alias: {
      'angular': 'angular/angular',
      'angularFormly': 'angular-formly/dist/formly',
      'apiCheck': 'api-check/dist/api-check',
      'formlyAngularTemplatesBootstrap': 'angular-formly-templates-bootstrap/dist/angular-formly-templates-bootstrap'
    }
  }
module: {
    loaders: [
      { test: /angular/, loader: 'exports-loader?angular' },
      { test: /apiCheck/, loader: '!imports-loader?angular' },
      { test: /angularFormly/, loader: '!imports-loader?angular,apiCheck' },
      { test: /formlyAngularTemplatesBootstrap/, loader: '!imports-loader?angular,angularFormly' },
    ]
  },

Now in JS file create module:

import 'angularFormly';
import 'formlyAngularTemplatesBootstrap';

export const FormlyUtilityModule = angular
  .module('formly-utility', [
    'formly',
    'formlyBootstrap'
  ])
  .name;

Unfortunately I got error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module formly-utility due to:
Error: [$injector:modulerr] Failed to instantiate module formlyBootstrap due to:
Error: [$injector:modulerr] Failed to instantiate module {"version":{"full":"1.5.8","major":1,"minor":5,"dot":8,"codeName":"arbitrary-fallbacks"},"callbacks":{}} due to:
Error: [ng:areq] Argument 'module' is not a function, got Object

Any ideas why 'formlyBootstrap' didn't works ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant