Uncaught TypeError: (0 , _typeof3.default) is not a function with babel6 in webpack

Compile some code below:

async function sleep(timeout) {
    return new Promise((resolve, reject) => {
        setTimeout(function () {
        }, timeout);

(async function () {
    console.log('Do some thing, ' + new Date());
    await sleep(3000);
    console.log('Do other things, ' + new Date());

Compile successfully, but error occurs in browser:

Uncaught TypeError: (0 , _typeof3.default) is not a function

Use Babel6 and compile the code, it worked in NodeJS. And, how to make it work well in browser with webpack

Author: Fantashit

2 thoughts on “Uncaught TypeError: (0 , _typeof3.default) is not a function with babel6 in webpack

  1. In my case, I added the following to my webpack config “module.loaders”:

    exclude: /node_modules/

    For completeness, my full webpack config looks like:

        devtool: 'inline-source-map',
        module: {
            loaders: [{
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel'

    When I add the exclusion to node_modules/ everything works as expected.

  2. if anyone is still having issues with this make sure that the exclude does note contain quotes, i.e. “/node_modules/” or ‘/node_modules/’ . there is a lot of examples and boilerplate code like this, so I was still getting this compile error, because webpack as ignoring the exclude item on the loaders array. Thankfully I got some help on the babel slack channel! I hope that helps someone going bananas like I was before 😀

Comments are closed.