Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

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

Open
gentooboontoo opened this issue Sep 29, 2016 · 0 comments
Open

Comments

@gentooboontoo
Copy link

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).

@gentooboontoo gentooboontoo changed the title Cannot import a module when using the test example code Cannot import a module when using the browser test example code Sep 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant