I'm trying to write a class in ES6 and transpile it into a library as an AMD module with Babel (and bundle with jQuery in the same file) so people can use it like this:
<script src="Foo.js"></script>
<script>
    var dummy = new Foo();
</script>
I followed the solution here and arrange my folder like this:
-dist
-js
  |--Foo.js
  |--main.js
-lib
  |--jquery.js
-node_modules
-webpack.config.js
-.babelrc
-.eslintrc
-package.json
and Foo.js:
import $ from '../lib.jquery.js';
export default class Foo {
    constructor(){
        /* jQuery stuff */
    }
}
and main.js:
module.exports = require('./Foo.js').default;
and webpack.config.js:
require('babel-polyfill');
const path = require('path');
const webpack = require('webpack');
module.exports = {
    name: "bundle-js",
    entry: {
        Foo: [
            // configuration for babel6
            'babel-polyfill',
            './js/main.js'
        ]
    },
    output: {
        path: path.resolve(__dirname, 'dist'),  // ./build
        filename: '[name].bundle.js',
        library: 'Foo',
        libraryTarget: 'umd'
    },
    module: {
        rules: [{
            test: /\.js$/,
            loader: ['babel-loader', 'eslint-loader'],
            exclude: /node_modules/,
        }]
    },
    stats: {
        colors: true
    },
    devtool: 'source-map'
};
and .babelrc:
{
    "plugins": ["transform-es2015-modules-amd"],
    "presets": ["react", "es2015","stage-0"]
}
And I kept getting this error:
js/main.js: Property object of MemberExpression expected node to be of a type ["Expression"] but instead got null
Can somebody please help me and tell me what went wrong so I can fix it? AMD is more of my preference, so if someone has a solution that uses CommonJS and does the same thing, I'm open to it.
Edit: To avoid distraction, this problem has nothing to do with Webpack, as I used the command babel --presets es2015 --plugins transform-es2015-modules-amd js/main.js -o dist/Foo.bundle.js and still have the same error.