question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: angular.module is not a function

See original GitHub issue

My webpack.config.js as below

var path = require('path')
, webpack = require('webpack')

module.exports = {
    context : __dirname,

    resolve : {
        modulesDirectories : [ 'node_modules', 'bower_components' ],
        extensions : [ '', '.js', '.jsx' ]
    },

    entry : {
        app: './static/scripts/app.js'
    },
    output : {
        path : path.resolve('./assets'), // bridge point to django
        filename : '[name].js'
    },

    plugins : [
        /*
        new webpack.ResolverPlugin(
            new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
        )
        */
    ],

    devtool : 'source-map'
}

My demo project looks like image

if I enable webpack.ResolverPlugin, I will get below error when open index.html in the browser image

Running webpack output(with webpack.ResolverPlugin or not) looks like below: image

Where have I done wrong? Plz kindly help me out, thx.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19

github_iconTop GitHub Comments

15reactions
trinitroglycerincommented, Feb 18, 2016

Angular doesn’t seem to support CommonJS. You’ll need to shim it with exports-loader.

      { loader: 'exports?window.angular', test: require.resolve('angular') },

They did put in their changelog that they were supporting CommonJS, but I’ve always had this issue with the library.

5reactions
lili21commented, Sep 1, 2016

@danpantry by the way, I rename raven-js/plugins/angular.js file to something else, like raven-js/plugins/ra-ng.js, and It works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: angular.module is not a function at
You are trying to use a variable called angular. Think what causes that variable to exist. That is found in the angular.js script...
Read more >
angular.module(...).info is not a function in angular-aria #15786
I encountered the following bug - after upgrading angular-aria to recently released v1.6.3 I'm getting the following error: Uncaught ...
Read more >
TypeError: Object(...) is not a function at Module ... - Telerik
Hi ,I'm using Kendo with angular 7.2.0 but getting this error - TypeError: ... is not a function at Module node_modules/@progress/kendo-an.
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
Angular Modules - W3Schools
The module is a container for the application controllers. ... A module is created by using the AngularJS function angular.module. <div ng-app="myApp">.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found