Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing Errors in ES6 modules #707

Closed
chrisgodsey opened this issue Jul 11, 2018 · 3 comments
Closed

Importing Errors in ES6 modules #707

chrisgodsey opened this issue Jul 11, 2018 · 3 comments

Comments

@chrisgodsey
Copy link

I've been having a few different issues importing from ES6 modules that have otherwise worked that have had me to refactor some of my existing code in order to get it working with K6.

  1. Importing from files requires the .js file extension when an ES6 module ordinarilly would not.

Example - if my module is written to: import ClassName from './classFile'; I will receive the error that 'The system cannot find the file specified', if I change this line to import ClassName from './classFile.js'; it works fine

  1. Importing from index files does not seem to work appropriately.

Example, if I have any kind of indexing file that may be common in ES modules:

import Class1 from './class1File.js';
import Class2 from './class2File.js';

export default {
Class1,
Class2
};

if I attempt to import the above file and then create new instances of Class1 and Class2 (as I would be able to normally in an ES6 module), I cannot - however, if I directly import them from class1File and class2File, I am able to do so

@na-- na-- added this to the v1.0.0 milestone Oct 15, 2018
@na--
Copy link
Member

na-- commented Oct 15, 2018

The first issue is also duplicated in #475 and #778, while the second one may be somewhat related to #659.

@mstoykov
Copy link
Contributor

I am closing this as this was most likely fixed in #1099 merged with commit bd6d2d9 . I did try to reproduce this bug in previous versions ... but it worked all the way back to 0.19.0 and I decided that probably my example isn't using what is broken.

If this is still not resolved please reopen the issue and provide a full example that fails.

@mstoykov
Copy link
Contributor

The code I ran can be find in this gist

@na-- na-- removed this from the v1.0.0 milestone Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants