systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
83 stars 33 forks source link

Cannot import a module when using the browser test example code #65

Open gentooboontoo opened 7 years ago

gentooboontoo commented 7 years ago

To test and understand how to use the plugin, I am just trying to import a module as a dependency in the code used by test/manual.html. Despite having read the documentation of Babel, SystemJS and plugin-babel, trying different configuration options, I have never managed to make it work.

So here the simplest case based on the current code of the test:

Added test/foo-mod.js:

export default var foo = 7;

Modified test/manual.js:

import foo from './foo-mod'; // --> 404 Not Found
//import foo from './foo-mod.js'; // --> Unexpected token (1:15)

export var p = 5;

The first line throws Not Found whereas the path is correct (except for the .js extension). The second one throws unexpected token when .js is explicitely added.

Isn't the specific build of Babel of this plugin supposed to make this work out of the box? Is there any additional preset or plugin to enable? What am I missing?

(I have made a branch in my fork with the above changes for reproducing purpose: https://github.com/gentooboontoo/plugin-babel/tree/import-test).