Error finding exported modules

1

I have a problem and that using the library es6-module-loader-dev is giving me an error to get the classes that I'm importing. The truth initially I thought it was the route, but after checking them, see if the classes had the export and if everything was on the indicated routes I still get the error.

My code is as follows:

Car Class:

export default class vehicle {
    constructor(){
    }
}

Carros y drones class:

import Vehicle from './vehicle';

export class Car extends Vehicle {
    constructor(){
        super();
    }
}


import {Vehicle} from './vehicle';

export default class Drone extends Vehicle {
    constructor(){
        super();
    }
}

Main Class:

import {Car} from './classes/car';
import {Drone} from './classes/drone';

Index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="node_modules/traceur/bin/traceur.js"></script>
    <script src="node_modules/es6-module-loader/dist/es6-module-loader-dev.js"></script>


</head>
<body>
    <script>
        System.import('src/app.js');
    </script>
</body>
</html>

Project structure:

The error that shows me in the browser is:

es6-module-loader-dev.src.js:1478 Uncaught (in promise) Error: Error loading http://localhost:3000/src/classes/car as "./classes/car" from http://localhost:3000/src/app.js     XHR error (404 Not Found) loading http://localhost:3000/src/classes/car
    at f (es6-module-loader-dev.src.js:1478)
    at XMLHttpRequest.g.onreadystatechange (es6-module-loader-dev.src.js:1499)
    
asked by Wilfredo 10.02.2017 в 18:58
source

1 answer

2

The es6-module-loader module requires that you specify the module suffix ( .js ) otherwise it will display a 404.

import {Car} from './classes/car.js';
import {Drone} from './classes/drone.js';
    
answered by 10.02.2017 / 19:20
source