3

I've been trying to setup angular 1 with webpack and ran into an issue with import modules, let's say I want to import ramda from node_modules

import angular from 'angular';
import uirouter form 'angular-ui-router';
import routing from './app.config';
import * as ramda from 'ramda';


angular.module('app', [uirouter, ramda])
  .config(routing);

I get an error: Argument 'module' is not a function, got Object. If I console ramda, it is indeed an object and I understand I need a string, but I just couldn't figure out how to get it?

1 Answer 1

1

Change it to import ramda from"ramda". This is because the export of the module is the module name. When you write import * as ramda you import the namespace object, which is an object containing all the exports of that module.

If you are using TypeScript, you may need to add a allowSyntheticDefaultImports to your tsconfig.json. allowSyntheticDefaultImports

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.