Невозможно добиться наследования в классах ES6 при импорте двух файлов с помощью сборщика модулей webpack с помощью babel
Моя структура каталогов выглядит так
webpack.config.js выглядит так
module.exports = {
entry: "./entry.js",
output: {
path: __dirname,
filename: "bundle.js"
},
module: {
loaders: [
{
loader: "babel-loader",
// Only run `.js` and `.jsx` files through Babel
test: /\.jsx?$/,
// Options to configure babel with
query: {
presets: ['es2015'],
}
},
]
}
};
Entry.js выглядит так
import './content.js';
import './content1.js';
content.js выглядит так
export class addition {
constructor(){
this.x = 10 ;
}
}
content1.js выглядит так
class subtraction extends addition{
constructor(){
super();
this.y = this.x - 5 ;
}
}
var inst = new subtraction();
console.log(inst.x, inst.y)
после создания bundle.js с помощью веб-пакета и запуска index.html: возникает ошибка типа
Пожалуйста, помогите мне понять, как добиться наследования в ES6 с помощью сборщика модулей webpack.